简体   繁体   中英

VB.NET WebBrowser Control OnClick Event Not Triggering

I'm using Vb.Net to trigger event listeners in a web-browser control, however it only seems to work on some site and not on others...

WebBrowser1.Document.GetElementById("button name").InvokeMember("click")
WebBrowser1.Document.GetElementById("button name").InvokeMember("Onclick")

It works on sites like adf.ly, gmail, google, but not on others. for example, On the airserver log in website ( http://www.airserver.com/Download ) it only works for some buttons. The "download for free" and "buy now" buttons all work.

But, the popup (comes up when you press download for free) has a "register for trial" button. I have tried to use these codes, they do not work. (Yes, I have put in my name and email into the required fields)

WebBrowser1.Document.GetElementById("registrButton").InvokeMember("click")
WebBrowser1.Document.GetElementById("registrButton").InvokeMember("Onclick")

I have also looked at the chrome event break-point, it tells me that it a "click" event was triggered.

This is the html code for the button if you are not bothered to go to airserver

<a id="registrButton" class="button register" href="#" onclick="$('#promoRequest').submit();return false;">Register for Trial</a>

It's because it's a pop up (probably ajax and the code is not viewable in the webbrowser).

But the solution is here, use this link would 100% work: http://www.airserver.com/register/PC

then redirect back to your download page, and do whatever you were doing.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM