Click here to Skip to main content
15,914,225 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:

Hi there,

Im working a web browser automation project. There is an ajax controlled dropdown list in a web site.

It was like this;

<option value="test1">test1</option>
<option value="test2">test2</option>
<option value="test3">test3</option>
<option value="test4">test4</option>
<option value="test5">test5</option>

When i was selected test2 ajax is working and its giving another div. (I need this div)

I use this codes;

webbrowser1.Document.GetElementsByTagName("select")[0].Document.GetElementsByTagName("option")[1].SetAttribute("selected", "selected");

Its only changing attribute and for this reason it doesnt working ajax.

How can i select option 1?

Thanks.

Posted

var chkBoxList = document.getElementById('drowndownlist1'); var chkBoxes = chkBoxList.getElementsByTagName("input"); chkBoxes[0].checked = true;
 
Share this answer
 
Yes, at last end i have done it.

webbrowser1.Document.GetElementsByTagName("select")[0].Document.GetElementsByTagName("option")[2].SetAttribute("selected", "selected");
webbrowser1.Document.InvokeScript("__doPostBack");


Its working perfectly.
Thanks for all.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900