Hi,
In one of the sites that I'm testing, for the dropdowns is used transForm jQuery plugin.
With Telerik Test Studio I can't find a way to record a selected item from this dropdown.
When I record the step were I select a item form the dropdown the studio does not recognize that this control is a dropdown and record Click 'Span' step.
Here is the site with example for such a dropdown.
Can you give a solution for this?
Thanks,
Boris
4 Answers, 1 is accepted
Hello,
I've tried to change the dropdown value in code step like this, but I can't find a way to change the text in span element.
Here is the DOM for the dropdown control
01.
<
div
class
=
"tf-select"
style
=
"width: 94px;"
>
02.
<
select
class
=
"no-ui"
name
=
"select"
>
03.
<
option
value
=
"1"
>Option 1</
option
>
04.
<
option
value
=
"2"
selected
=
""
>Option 2</
option
>
05.
<
option
value
=
"3"
>Option 3</
option
>
06.
<
option
value
=
"4"
>Option 4</
option
>
07.
<
option
value
=
"5"
>Option 5</
option
>
08.
</
select
>
09.
<
div
class
=
"tf-selected"
style
=
"width: 56px;"
>
10.
<
span
>Option 2</
span
>
11.
</
div
>
Additional I add a new elment in element repository for <select> element with name SelectDropDown.
In my site when I make a post request, the correct value is send to the server, but visually the value is not changed and when I perform a post the verification is triggerd and respectively the post request has failed.
Is there a way to change the text for the span element or something else?
01.
[CodedStep(@
"New Coded Step"
)]
02.
public
void
DropDownTest_CodedStep()
03.
{
04.
Pages.TransFormJQueryPlugin.SelectDropDown.SelectByText(
"Option 5"
,
true
);
05.
06.
ArtOfTest.WebAii.jQuery.jQueryControl jQueryControl = Pages.TransFormJQueryPlugin.SelectDropDown.AsjQueryControl();
07.
jQueryControl.InvokejQueryEvent(ArtOfTest.WebAii.jQuery.jQueryControl.jQueryControlEvents.change);
08.
09.
HtmlDiv divElement = Find.ByAttributes<HtmlDiv>(
"class=tf-selected"
,
"style=width:56px;"
);
10.
11.
// HtmlSpan spanElement = divElement.Find.ByTagIndex<HtmlSpan>("span", 0);
12.
13.
// spanElement.TextContent = "Option 5";
14.
}
Boris
Here is a sample test that open the drop down and select the 4th option.
The only change I have made to the test is that I've enabled SimulateRealClick options for the clicks.
Let me know if that works for you.
Regards,
Boyan Boev
Telerik
Thank you for your help, with SimulateRealClick did work.
In my case I only added a Wait step, to wait the dropdown menu to load before selecting an option.
Regards,
Boris
Happy to hear that.
If you need further assistance please let us know.
Regards,
Boyan Boev
Telerik