[RESOLVED] Invoking webpage submit button
Hi all,
I am having a bit of trouble invoking a button without any id or tag name from a webpage.
Here is the html code.
<div class="sbSubmit"><ul class="buttons floatRight" style='display:none;'><li class="btn" onclick="if ( validateSb() ) doLinkSubmit('../ha/default.aspx');return false;"/><div class="prettyBtn primaryBtn"> <span> Search </span></div>
Any suggestions on how to invoke the clicking of this button?
Thanks in advance.
Re: Invoking webpage submit button
Quote:
without any id or tag name
No tag name? Of course it's got a tag name! It can't exist without one. I'd start with tag "li", attribute classname (= "btn"), (try both click and onclick as member). If that doesn't get you anywhere try tag "div", attribute classname (= "sbSubmit").
Re: Invoking webpage submit button
Thanks for the reply, so do you mean something like:
Dim allelements As HtmlElementCollection = WebBrowser1.Document.All
For Each webpageelement As HtmlElement In allelements
If webpageelement.GetAttribute("classname") = "btn" Then
webpageelement.InvokeMember("onclick")
End If
Next
??
AttributeName: class, classname
Names: sbSubmit, btn, div, ul???
InvokeMember: click , onoclick
I am a bit confused with the order of things :/
Re: Invoking webpage submit button
Something very like that. The attribute is always 'classname' (that's the HTML standard). Try click first, then onclick (the standard is click but I've found onclick to be sometimes effective when that won't work).
Re: Invoking webpage submit button
Thanks for your help! I got it to work. Apparently the combo was btn and onclick.
Re: [RESOLVED] Invoking webpage submit button
One more quick question, after sending the submit button, I need to wait for the page to load before extracting some data. I have a wait_for_page_load function but it still seems to be performing the actions before its fully loaded. I tried the thread.sleep function, but it doesn't seem to be helping.