How can I click on this drop down box and select a value programmically? Code include

Joined
Apr 13, 2011
Messages
19
Programming Experience
Beginner

VB.NET:
<select id="questions" name="selection" >
  <option value="choosequestion" style="font-style:italic;">
  Choose a question ...
  </option>

  <option value="What is the name of your best friend from childhood?"
      
    >What is the name of your best friend from childhood?</option>
  <option value="What was the name of your first teacher?"
      
    >What was the name of your first teacher?</option>
  <option value="What is the name of your manager at your first job?"
      
    >What is the name of your manager at your first job?</option>
  <option value="What was your first phone number?"
      
    >What was your first phone number?</option>
  <option value="What is your vehicle registration number?"
      
    >What is your vehicle registration number?</option>
  <option value="What is your library card number?"

I haven't been able to grab an elements an auto select it from the page. Got any ideas on how to go about getting this to work?

Thanks.


Here's something that I've slapped gather and it does do anything

VB.NET:
       For
 Each element As HtmlElement In WebBrowser1.Document.GetElementsByTagName("select")(0).GetElementsByTagName("option")
            If element.InnerText = "What is the name of your best friend from childhood?" Then
                element.SetAttribute("selected", "True")

            End If

        Next
 
Back
Top