I'm a new user to Test Studio and looking to see of there is sample code, video or documentation on how to handle get and post requests to the server. I recorded a script where you fill in text into fields then the users clicks submit. The next page is a verification page to verify the information before submitting to the website. After hitting submit on that screen, the server doesn't get the information and the script fails.
This has happened three times now so I don't think it is just me :) ... WIthin the same project, I will copy and paste a test script and then rename the new version. I open the new version, delete a majority of the test steps and save (call this my "initial version" of the new test script). I then edit the new version extensively, saving several times intermittently, and run a number of times in a test list, both locally and remotely. All good so far. I close TestStudio, do a reboot of my machine and then re-open TestStudio. The test script now matches the "initial version" with all subsequent changes missing. Any idea what is going on?
Your help will be most appreciated! Thanks.
Briar
I am a newbie to Test , I just couldn’t find the answer directly from the help documents!
Question: I would like to extract a particular value from the I am testing and write it to a text file.
I tried
And in coded test:
public void MyFirstCodeTest_CodedStep()
{
string myData = GetExtractedValue(seconds);
System.IO.StreamWriter file = new System.IO.StreamWriter("c:\\source.txt");
file.WriteLine("Expected Result: "+ myData);
file.Close();
}
But it doesn’t help!
Can you suggest a please?
Please email the answer to minu@hot.co.nz
Thanks!
I am trying to define xpath as one of the find settings for an element in the element repository. I am replacing the automatically generated xpath with an xpath that works in the coded step using Find.ByXPath, but the identification fails after the auto generated xpath is replaced.
I would also like to know the difference between xpath and html path.
Default xpath generated: /article[1]/fieldset[1]/ol[1]/li[11]/span[2]/input[2]
Changed xpath: /ol/li[contains(span,'Speech conditions')]/span/input[@value='No'] (I have also tried adding the '@' escape character for the "," and "@" symbols in the xpath)
The following is the html of the page
<html class=" js flexbox canvas canvastext webgl no-touch geolocation postmessage no-websqldatabase indexeddb hashchange history draganddrop websockets rgba hsla multiplebgs backgroundsize borderimage borderradius boxshadow textshadow opacity cssanimations csscolumns cssgradients no-cssreflections csstransforms csstransforms3d csstransitions fontface generatedcontent video audio localstorage sessionstorage webworkers applicationcache svg inlinesvg no-smil svgclippaths" lang="en"><head>
<meta charset="utf-8">
<title></title>
<link href="/favicon.ico" rel="shortcut icon" type="image/x-icon">
<script src="https://ssl.google-analytics.com/ga.js" type="text/javascript" async=""></script><script src="/Scripts/App/namespace.js" type="text/javascript"></script>
<script src="/Scripts/App/modernizr.custom.24465.js" type="text/javascript"></script>
<link href="/Content/css?v=y9MbIqhxSJ9syvKPl6VvsW91UpoZTibWFIr7ztvYKyY1" rel="stylesheet" type="text/css">
<link href="/Content/ClientStyles/2008/css?v=cEvFed-VjJeJdJgeSzGl8h4W3IKEazh8p7RiAX-0XZk1" rel="stylesheet" type="text/css">
<link href="/Content/themes/base/css?v=AumV9aQh6a_U8B-s6SUUgfjxQegD-CiF3g84ONgQrY01" rel="stylesheet" type="text/css">
<meta name="viewport" content="width=device-width">
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', '']);
_gaq.push(['_trackPageview']);
(function () {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</head>
<body>
<noscript> <p class="alert-message alert-message-long alert-message-long-all">Your browser does not support JavaScript!</p></noscript>
<div class="ajaxLoderLook" id="testAjaxImage" style="display: none;">
<img alt="Loading..." src="/Images/ajaxloader.gif">
</div>
<div class="content">
<header>
<div class="content-wrapper header-content">
<img class="float-right main-logo" alt="logo" src="/Images/Logos/hannover_re.png">
<a class="apply button decisionSummary" id="btnDecisionSummary" href="#">Decision Summary</a>
<div class="age">
<span>Age: 41</span>
</div>
<fieldset>
<h3>Applicant: Johnni Jones</h3>
<h3>Age Next birthday: 41 (11/08/1976)</h3>
</fieldset>
</div>
</header>
<div id="body">
<section class="content-wrapper main-content clear-fix">
<div id="content">
<div id="innerContent" style="visibility: visible;">
<div class="statusbar-container">
<div class="statusbar">
<div class="statusbar-item" style="display: block;">
Review
</div>
<div class="statusbar-item" style="display: block;">
Your declaration
</div>
</div>
</div>
<article>
<fieldset>
<legend>Direct Medical</legend>
<input name="categoryId" id="categoryId" type="hidden" value="3502">
<input name="yesRequired" id="yesRequired" type="hidden" value="False">
<ol data-bind="foreach: { data: questions, afterRender: initControls }">
<!-- ko if: type == 'Group' -->
<li>
<h4 data-bind="text: text">In the last 5 years have you suffered from, been diagnosed with or sought medical advice or treatment for:</h4>
</li>
<!-- /ko -->
<!-- ko if: type == 'YesNo' --><!-- /ko -->
<!-- ko if: type == 'Group' --><!-- /ko -->
<!-- ko if: type == 'YesNo' -->
<li>
<span class="question-text group-question-label" data-bind="text: text, css: { 'invalid-question': !answer.isValid() }">High Blood Pressure (other than fully resolved pregnancy related high blood pressure)</span>
<span data-bind="foreach: $parent.answerOptions">
<span data-bind="text: value">Yes</span><input name="4548" type="radio" value="Yes" data-bind="value: key, attr: { name: $parent.qid, 'data-qcode': $parent.qcode }, checked: $parent.answer, css: { 'readonly': $parent.readOnly }" data-qcode="DMEDI00Q1_1_BD">
<span data-bind="text: value">No</span><input name="4548" type="radio" value="No" data-bind="value: key, attr: { name: $parent.qid, 'data-qcode': $parent.qcode }, checked: $parent.answer, css: { 'readonly': $parent.readOnly }" data-qcode="DMEDI00Q1_1_BD">
</span>
</li>
<!-- /ko -->
<!-- ko if: type == 'Group' --><!-- /ko -->
<!-- ko if: type == 'YesNo' -->
<li>
<span class="question-text group-question-label" data-bind="text: text, css: { 'invalid-question': !answer.isValid() }">High Cholesterol</span>
<span data-bind="foreach: $parent.answerOptions">
<span data-bind="text: value">Yes</span><input name="4577" type="radio" value="Yes" data-bind="value: key, attr: { name: $parent.qid, 'data-qcode': $parent.qcode }, checked: $parent.answer, css: { 'readonly': $parent.readOnly }" data-qcode="DMEDI00Q1_2_BD">
<span data-bind="text: value">No</span><input name="4577" type="radio" value="No" data-bind="value: key, attr: { name: $parent.qid, 'data-qcode': $parent.qcode }, checked: $parent.answer, css: { 'readonly': $parent.readOnly }" data-qcode="DMEDI00Q1_2_BD">
</span>
</li>
<!-- /ko -->
<!-- ko if: type == 'Group' -->
<li>
<h4 data-bind="text: text">Have you EVER suffered from, been diagnosed with or sought medical advice or treatment for:</h4>
</li>
<!-- /ko -->
<!-- ko if: type == 'YesNo' --><!-- /ko -->
<!-- ko if: type == 'Group' --><!-- /ko -->
<!-- ko if: type == 'YesNo' -->
<li>
<span class="question-text group-question-label" data-bind="text: text, css: { 'invalid-question': !answer.isValid() }">Lung or Breathing conditions (other than childhood Asthma), Digestive conditions or Urinary conditions</span>
<span data-bind="foreach: $parent.answerOptions">
<span data-bind="text: value">Yes</span><input name="4595" type="radio" value="Yes" data-bind="value: key, attr: { name: $parent.qid, 'data-qcode': $parent.qcode }, checked: $parent.answer, css: { 'readonly': $parent.readOnly }" data-qcode="DMEDI00Q2_1_BD">
<span data-bind="text: value">No</span><input name="4595" type="radio" value="No" data-bind="value: key, attr: { name: $parent.qid, 'data-qcode': $parent.qcode }, checked: $parent.answer, css: { 'readonly': $parent.readOnly }" data-qcode="DMEDI00Q2_1_BD">
</span>
</li>
<!-- /ko -->
<!-- ko if: type == 'Group' --><!-- /ko -->
<!-- ko if: type == 'YesNo' -->
<li>
<span class="question-text group-question-label" data-bind="text: text, css: { 'invalid-question': !answer.isValid() }">Gynaecological conditions, or Pregnancy</span>
<span data-bind="foreach: $parent.answerOptions">
<span data-bind="text: value">Yes</span><input name="5448" type="radio" value="Yes" data-bind="value: key, attr: { name: $parent.qid, 'data-qcode': $parent.qcode }, checked: $parent.answer, css: { 'readonly': $parent.readOnly }" data-qcode="DMEDI00Q2_8_BD">
<span data-bind="text: value">No</span><input name="5448" type="radio" value="No" data-bind="value: key, attr: { name: $parent.qid, 'data-qcode': $parent.qcode }, checked: $parent.answer, css: { 'readonly': $parent.readOnly }" data-qcode="DMEDI00Q2_8_BD">
</span>
</li>
<!-- /ko -->
<!-- ko if: type == 'Group' --><!-- /ko -->
<!-- ko if: type == 'YesNo' -->
<li>
<span class="question-text group-question-label" data-bind="text: text, css: { 'invalid-question': !answer.isValid() }">Brain conditions, Nerve conditions, Recurrent Headaches, Migraines, Psychological or Emotional conditions</span>
<span data-bind="foreach: $parent.answerOptions">
<span data-bind="text: value">Yes</span><input name="4597" type="radio" value="Yes" data-bind="value: key, attr: { name: $parent.qid, 'data-qcode': $parent.qcode }, checked: $parent.answer, css: { 'readonly': $parent.readOnly }" data-qcode="DMEDI00Q2_2_BD">
<span data-bind="text: value">No</span><input name="4597" type="radio" value="No" data-bind="value: key, attr: { name: $parent.qid, 'data-qcode': $parent.qcode }, checked: $parent.answer, css: { 'readonly': $parent.readOnly }" data-qcode="DMEDI00Q2_2_BD">
</span>
</li>
<!-- /ko -->
<!-- ko if: type == 'Group' --><!-- /ko -->
<!-- ko if: type == 'YesNo' -->
<li>
<span class="question-text group-question-label" data-bind="text: text, css: { 'invalid-question': !answer.isValid() }">Cancer, Cysts, Growths, Polyps, Tumours or Thyroid conditions</span>
<span data-bind="foreach: $parent.answerOptions">
<span data-bind="text: value">Yes</span><input name="4599" type="radio" value="Yes" data-bind="value: key, attr: { name: $parent.qid, 'data-qcode': $parent.qcode }, checked: $parent.answer, css: { 'readonly': $parent.readOnly }" data-qcode="DMEDI00Q2_3_BD">
<span data-bind="text: value">No</span><input name="4599" type="radio" value="No" data-bind="value: key, attr: { name: $parent.qid, 'data-qcode': $parent.qcode }, checked: $parent.answer, css: { 'readonly': $parent.readOnly }" data-qcode="DMEDI00Q2_3_BD">
</span>
</li>
<!-- /ko -->
<!-- ko if: type == 'Group' --><!-- /ko -->
<!-- ko if: type == 'YesNo' -->
<li>
<span class="question-text group-question-label" data-bind="text: text, css: { 'invalid-question': !answer.isValid() }">Heart related conditions, Diabetes, Kidney, Gall Bladder, Pancreas or Liver conditions</span>
<span data-bind="foreach: $parent.answerOptions">
<span data-bind="text: value">Yes</span><input name="4601" type="radio" value="Yes" data-bind="value: key, attr: { name: $parent.qid, 'data-qcode': $parent.qcode }, checked: $parent.answer, css: { 'readonly': $parent.readOnly }" data-qcode="DMEDI00Q2_4_BD">
<span data-bind="text: value">No</span><input name="4601" type="radio" value="No" data-bind="value: key, attr: { name: $parent.qid, 'data-qcode': $parent.qcode }, checked: $parent.answer, css: { 'readonly': $parent.readOnly }" data-qcode="DMEDI00Q2_4_BD">
</span>
</li>
<!-- /ko -->
<!-- ko if: type == 'Group' --><!-- /ko -->
<!-- ko if: type == 'YesNo' -->
<li>
<span class="question-text group-question-label" data-bind="text: text, css: { 'invalid-question': !answer.isValid() }">Auto Immune Diseases or Blood conditions</span>
<span data-bind="foreach: $parent.answerOptions">
<span data-bind="text: value">Yes</span><input name="4603" type="radio" value="Yes" data-bind="value: key, attr: { name: $parent.qid, 'data-qcode': $parent.qcode }, checked: $parent.answer, css: { 'readonly': $parent.readOnly }" data-qcode="DMEDI00Q2_5_BD">
<span data-bind="text: value">No</span><input name="4603" type="radio" value="No" data-bind="value: key, attr: { name: $parent.qid, 'data-qcode': $parent.qcode }, checked: $parent.answer, css: { 'readonly': $parent.readOnly }" data-qcode="DMEDI00Q2_5_BD">
</span>
</li>
<!-- /ko -->
<!-- ko if: type == 'Group' --><!-- /ko -->
<!-- ko if: type == 'YesNo' -->
<li>
<span class="question-text group-question-label" data-bind="text: text, css: { 'invalid-question': !answer.isValid() }">Speech conditions, Eye conditions, Ear conditions or Non-Cancerous Skin conditions</span>
<span data-bind="foreach: $parent.answerOptions">
<span data-bind="text: value">Yes</span><input name="4605" type="radio" value="Yes" data-bind="value: key, attr: { name: $parent.qid, 'data-qcode': $parent.qcode }, checked: $parent.answer, css: { 'readonly': $parent.readOnly }" data-qcode="DMEDI00Q2_6_BD">
<span data-bind="text: value">No</span><input name="4605" type="radio" value="No" data-bind="value: key, attr: { name: $parent.qid, 'data-qcode': $parent.qcode }, checked: $parent.answer, css: { 'readonly': $parent.readOnly }" data-qcode="DMEDI00Q2_6_BD">
</span>
</li>
<!-- /ko -->
<!-- ko if: type == 'Group' --><!-- /ko -->
<!-- ko if: type == 'YesNo' -->
<li>
<span class="question-text group-question-label" data-bind="text: text, css: { 'invalid-question': !answer.isValid() }">Back, Neck or Knee complaint or any disorder of the Joints, Bones or Muscles (e.g. Gout, Arthritis)</span>
<span data-bind="foreach: $parent.answerOptions">
<span data-bind="text: value">Yes</span><input name="4607" type="radio" value="Yes" data-bind="value: key, attr: { name: $parent.qid, 'data-qcode': $parent.qcode }, checked: $parent.answer, css: { 'readonly': $parent.readOnly }" data-qcode="DMEDI00Q2_7_BD">
<span data-bind="text: value">No</span><input name="4607" type="radio" value="No" data-bind="value: key, attr: { name: $parent.qid, 'data-qcode': $parent.qcode }, checked: $parent.answer, css: { 'readonly': $parent.readOnly }" data-qcode="DMEDI00Q2_7_BD">
</span>
</li>
<!-- /ko -->
</ol>
</fieldset>
</article>
<nav class="nav">
<a title="navigate next" class="standout button float-right" href="#" data-bind="event:{ click: navigateNext }">Next</a>
<a title="navigate previous" class="button float-left" href="#" data-bind="event:{ click: navigatePrevious }">Previous</a>
</nav>
<aside>
<div class="aside-container">
<p class="field-validation-error" data-bind="validationMessage: isDataValid"></p>
<div class="help-text" data-bind="html: helpText.selectedText"></div>
<div class="aside-footer help-text" data-bind="html: helpText.footerText">For more information please refer to the Product Disclosure Statement which contains all of the details of cover plus terms and conditions of cover.</div>
</div>
</aside>
</div>
</div>
</section>
</div>
<footer>
<div class="content-wrapper">
<div class="float-left">
© Hannover Life Re of Australasia Ltd
</div>
</div>
</footer>
</div>
<script type="text/javascript">
maz.baseUrl = '/';
</script>
<script src="/Scripts/Lib/js?v=QPWEIV3aAl4mBKiTff9diiX6D5tUEZmRw2CZauQq2M41" type="text/javascript"></script>
<script src="/Scripts/App/Views/group.js" type="text/javascript"></script>
<script src="/Scripts/App/ajaxLoader.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function () {
master.constructDecision();
maz.utils.loadView(true);
});
</script>
<div tabindex="-1" class="ui-dialog ui-widget ui-widget-content ui-corner-all ui-draggable ui-resizable" role="dialog" aria-labelledby="ui-dialog-title-dvDecisionSummary" style="outline: 0px; display: none; position: absolute; z-index: 30000;"><div class="ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix"><span class="ui-dialog-title" id="ui-dialog-title-dvDecisionSummary"> </span><a class="ui-dialog-titlebar-close ui-corner-all" role="button" href="#"><span class="ui-icon ui-icon-closethick">close</span></a></div><div class="ui-dialog-content ui-widget-content" id="dvDecisionSummary"></div><div class="ui-resizable-handle ui-resizable-n"></div><div class="ui-resizable-handle ui-resizable-e"></div><div class="ui-resizable-handle ui-resizable-s"></div><div class="ui-resizable-handle ui-resizable-w"></div><div class="ui-resizable-handle ui-resizable-se ui-icon ui-icon-gripsmall-diagonal-se ui-icon-grip-diagonal-se" style="z-index: 1001;"></div><div class="ui-resizable-handle ui-resizable-sw" style="z-index: 1002;"></div><div class="ui-resizable-handle ui-resizable-ne" style="z-index: 1003;"></div><div class="ui-resizable-handle ui-resizable-nw" style="z-index: 1004;"></div></div></body></html>
Hi,
I have a combobox where I am trying to select an item by text, but it seems that I am not able to do so.
I have tried to use the following method
When I use combobox.selectItemByText("Text") I get a null reference exception.
The whole method:
public
void
selectItemFromComboBox(WpfApplication app,
string
comboBoxAutoId,
string
itemToSelect)
{
ArtOfTest.WebAii.Controls.Xaml.Wpf.ComboBox combo;
Thread.Sleep(350);
app.MainWindow.RefreshVisualTrees();
combo = app.MainWindow.Find.
ByAutomationId<ArtOfTest.WebAii.Controls.Xaml.Wpf.ComboBox>(comboBoxAutoId);
combo.OpenDropDown(
true
);
FrameworkElement indicator;
for
(
int
i = 0; i < 50; i++)
{
app.MainWindow.RefreshVisualTrees();
Thread.Sleep(350);
indicator = app.MainWindow.Find.ByTextContent(itemToSelect);
if
(indicator !=
null
)
{
for
(
int
j = 0; j < 50; j++)
{
Thread.Sleep(1000);
app.MainWindow.RefreshVisualTrees();
combo.Refresh();
combo.SelectItemByText(
true
, itemToSelect);
Debug.WriteLine(
"AAAAAA"
);
Thread.Sleep(500);
if
(combo.Text.Equals(itemToSelect))
{
Thread.Sleep(350);
break
;
}
}
}
}
Please note that I am using a framework element to ensure that the item is visible/not null.
The xaml of the combobox:
<ComboBox x:Name=
"cmbAttributeType"
Grid.Row=
"0"
Grid.Column=
"1"
materialDesign:HintAssist.Hint=
"Select Type"
Style=
"{StaticResource MaterialDesignFloatingHintComboBox}"
ItemsSource=
"{Binding Path=AttributeTypesAvailable, ElementName=LevelAttributes}"
SelectedItem=
"{Binding Path=SelectedAttributeType, ElementName=LevelAttributes}"
IsEditable=
"True"
IsReadOnly=
"True"
Margin=
"3,0,0,0"
AutomationProperties.AutomationId=
"Level_Att_Type_ComboBox"
/>
I tried doing this with a Framework element (opening the combobox and then clicking on the FWE), but every time I click on the FWE the comboboxlist closes and the comboboxitem is not selected. This is the same for clicking on a combobox item from an Ilist of the combobox.
Any help on this would be great.
Many thanks in advance,
David
Hello
Our application raises two pop ups upon close action
First is a save changes confirmation which test studio can handle but after that an internet explorer dialog raises and asks are you sure you want to leave this page in a windows dialog.
I cant manage to handle this problem and it makes internet explorers stack and blocks our test list executions
I am open to every work around if you guys have an idea :)
Thanks in Advance
I have a varriable a with contains the value .I need to click on the link having the value of the varriable. Example on screen has a lick as <id-217>. i have captured the same in a varriable.i need to click the same .
Please help
I would like to know if the ordered list can be assigned to the HtmlUnorderedList object. If it cannot be assigned is there a way to handle the ordered list.
Hi,
I need the Project Path to create log files in respective folder. I am able to get the Project Path in non-static class/functions using "this.ExecutionContext.DeploymentDirectory;". However; when I try same in static classes/functions it gives error like "Keyword 'this' is not valid in a static property, static method, or static field initializer" which is valid as we cannot do that.
Is there any other way I can use get DeploymentDirectory in static class/function?
Thanks,
Chandresh Parmar