cybeh
asked on
VB 6.0 webbrowser control to automate html dropdown selection
I had placed a webbrowser control in my form
Private Sub Form_Load()
WebBrowser1.Navigate2 "http://www.abc.com/"
Do While WebBrowser1.Busy = True
DoEvents
Loop
WebBrowser1.Document.Forms (0).Userna me.Value = "debehs"
End Sub
While there is a combo box with the name "cmbArea", and I need to give the answer as "Area A". I tried to code it this way but no luck.
WebBrowser1.Document.Forms (0).cmbAre a.Value = "Area A"
Please Advice. Thanks in advance !!!
========================== ======
Web coding
========================== =======
<select name="cmbArea">
<option value="" selected>
<option>Area A
<option>Area B</select>
Private Sub Form_Load()
WebBrowser1.Navigate2 "http://www.abc.com/"
Do While WebBrowser1.Busy = True
DoEvents
Loop
WebBrowser1.Document.Forms
End Sub
While there is a combo box with the name "cmbArea", and I need to give the answer as "Area A". I tried to code it this way but no luck.
WebBrowser1.Document.Forms
Please Advice. Thanks in advance !!!
==========================
Web coding
==========================
<select name="cmbArea">
<option value="" selected>
<option>Area A
<option>Area B</select>
ASKER
Hi,
Thanks for the reply. http://www.abc.com is just a sample.
Please have a look on this form
http://www.teccalibre.com/test.html
The code
WebBrowser1.Document.Forms (0).Elemen ts("cmbAre a").Value = "Area A"
will work if the page was coded with
<select name="cmbArea">
<option value="" selected>
<option value = "Area A">Area A
<option value = "Area B">Area B</select>
Please advice.
Thanks for the reply. http://www.abc.com is just a sample.
Please have a look on this form
http://www.teccalibre.com/test.html
The code
WebBrowser1.Document.Forms
will work if the page was coded with
<select name="cmbArea">
<option value="" selected>
<option value = "Area A">Area A
<option value = "Area B">Area B</select>
Please advice.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
By the way, full details on all such options can be found here:
http://www.activevb.de/tutorials/tut_browsertags/browsertags.html (it's in German, and the translation isn't perfect, but the code examples are excellent).
http://www.activevb.de/tutorials/tut_browsertags/browsertags.html (it's in German, and the translation isn't perfect, but the code examples are excellent).
For those that don't speak German, you can go to www.google.com/translate_t, paste the URL above in the "Translate a web page" textbox, and much of the Web page will be translated. For the remainder, or to translate a small part of the text, drop it into the "Translate text" textbox of the Google page.
I'm not seeing the Combobox you mention; maybe I'm just missing it, but I am being redirected to this URL:
http://abc.go.com/
In any event, the usual syntax to write to a form element value is:
WebBrowser1.Document.Forms