ansori
asked on
Click a button in webbrowser
i want click a button in this form
i am trying to use this : WebBrowser1.Document.All(" submit").I nvokeMembe r("click")
but it not work
and get error message
"NullRefferenceException was unhandled"
i am trying to use this : WebBrowser1.Document.All("
but it not work
and get error message
"NullRefferenceException was unhandled"
<form method="POST">
<div class="txtarea">
<input id="id_url" name="url" class="txt filled" type="text" value="stick the web address here" />
</div>
<input class="big-red" type="submit" value="Submit URL »" />
</form>
That code is trying to find an <input> element with the "submit" name, and the element doesn't have a name.
ASKER
so, what the solution?
If you know that there is only 1 <input> element, you could use the Document.GetElementsByTagN ame method to get the <input> elements:
Example:
Dim inputElementList As HtmlElementCollection = browser.Document.GetElemen tsByTagNam e("input")
Example:
Dim inputElementList As HtmlElementCollection = browser.Document.GetElemen
ASKER
no, it have more than 6 input element and 2 form.
Then, you can get the <input> elements in the collection, and loop through to find the element that you need.
ASKER
<form class="searchbox" action="/search/" method="get">
<input class="txt filled" style="vertical-align:middle" type="text" name="q" value="Look it Up. I bet we have it!" />
<input style="vertical-align:middle" type="image" src="http://o.aolcdn.com/propeller/images/searchbox-btn-2.gif" />
</form>
<form method="POST">
<div class="txtarea">
<input id="id_url" name="url" class="txt filled" type="text" value="stick the web address here" />
</div>
<input class="big-red" type="submit" value="Submit URL »" />
</form>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
work, thanks