Click here to Skip to main content
15,888,521 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;

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

<p></p>

<p>How can i select option 1?</p>

<p>Thanks.</p>
Its only changing attribute and for this reason it doesnt working ajax.
Posted
Updated 16-Nov-09 10:30am
v2

1 solution

I just tried this, and your code above is

GetElementsByTagName("option")[1]

which is the second option, it is a 0 based collection change to [0] and you will select the 1st option.

 
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