From: Alexandros Peropulous on
With WebBrowser1.SetFocus I can set the focus on the WebBrowser control,
but I have to click manually in a text search box for example.
I would like to activate the first input element in a html document in
my WebBrowser control programmatically so that I can type into it. I
think I have to iterate through all elements, but I am not sure on which
condition I should stop. Can somebody please help me? I cannot script
this because I never know where exactely the first text box will be.

Have a nice day.
Alex
From: Mayayana on
So the webpage could be anything? You
know it has at least one text input, but you
don't have an ID for that? The members
of the All collection are HTMLElement objects,
so you can access their attributes as long as the
attribute you use is valid:

For i = 0 to WB.document.all.length - 1
If WB.document.all(i).tagName = "INPUT" then
if WB.document.all(i).Type = "TEXT" Then

.......etc.

I don't know for certain that that will always get
the first textbox on the page. You might need to
test out variations. For instance, does a textbox inside
a Form come earlier in the all collection than a textbox
that follows a form? I don't know.


| With WebBrowser1.SetFocus I can set the focus on the WebBrowser control,
| but I have to click manually in a text search box for example.
| I would like to activate the first input element in a html document in
| my WebBrowser control programmatically so that I can type into it. I
| think I have to iterate through all elements, but I am not sure on which
| condition I should stop. Can somebody please help me? I cannot script
| this because I never know where exactely the first text box will be.
|
| Have a nice day.
| Alex