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.
}
Thanks,
Boris
or something else
or something else