Select option.selected = true is not going through
Posted: Fri Jul 12, 2013 9:45 am
Hi,
I'm trying to do a select option from an webpage but its not going through.
I used the code below which someone from forum posted in another topic. I can see that the changes goes through, but its not used, hard to explain .
I can see that the selections is done if i debug/pause after the selection, but when it goes to nextpage its supposed to use that selected option, but there its wrong, it goes back to orginal value. Its like it never clicked.
I mean i can get this working through different way, like first clicking on the object then pressing down arrow until i see my option and then press enter. But thats a bad way to code and if the select option list is very long like 100 options its a pain .
Anyone got any suggestions, please let me know, would really appreciate it!
Br,
Feroz
I'm trying to do a select option from an webpage but its not going through.
I used the code below which someone from forum posted in another topic. I can see that the changes goes through, but its not used, hard to explain .
I can see that the selections is done if i debug/pause after the selection, but when it goes to nextpage its supposed to use that selected option, but there its wrong, it goes back to orginal value. Its like it never clicked.
Code: Select all
SelectTag someSelectTag = "yourSelectTagPath";
IList<OptionTag> list = someSelectTag.FindChildren<OptionTag>();
foreach(OptionTag opTag in list){
// Output of all Option Tags
Report.Info("OptionTag: "+opTag.InnerText);
// Selection of yourTag
if(opTag.InnerText=="YourTag")
opTag.Selected= true;
}
Anyone got any suggestions, please let me know, would really appreciate it!
Br,
Feroz