VB.NET WebBrowser Control OnClick Event Not Triggering - vb.net

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.

Related

How do i reset Safari 12 beforeunload events after pressing "Leave Page" without refreshing?

I have a webpage with a form on it, and a beforeunload event.
When the page first loads, if the form is changed, a confirmation message appears on both Safari and Chrome.
In Chrome - if i press "leave page" and then return to the page, future changes keep invoking the conformation upon attempt to leave the page.
In Safari - if i press "leave page" and then return to the page, future changes to the form don't invoke the message when leaving the page, and the target page is loaded without problems.
If i refresh the page, the confirmation "resets".
I develop using Oracle Apex 5.1, but according to different forums this happens regardless of the platform:
https://github.com/codedance/jquery.AreYouSure/issues/112
Can you help me find a workaround?
Can i "Reset" safari without refreshing the page?

Can't click button using InternetExplorer.Application

I'm trying to click the "Continue" button programatically using the InternetExplorer.application object on the page "http://www.dallascounty.org/criminalBackgroundSearch/". When I click the button, nothing happens.
Below is my code:
loie = CREATEOBJECT('internetExplorer.application')
loie.Navigate2('http://www.dallascounty.org/criminalBackgroundSearch/')
loie.Visible = .T.
loSubmitButton = loie.Document.getElementsByName('Submit')
loSubmitButton.item[0].Click()
Until about a week ago, the button was clicking with no problem. I realize there is also a capatcha on this page, but even if a manually click the "I am not a robot" box, I still can now programmatically click the "Continue" button on the page. Could somebody please tell me what this site did to their page that is preventing me from programmatically clicking buttons and how to get around it?
I also would like to get passed that captcha programmatically, but that is a separate problem which I will deal with later. However, if anybody has any tips on how to get passed that captha as well, I would be greatful.
Thank you

Set focus() back to contenteditable

I'm building a mini WYSIWYG editor with a modal window (Twitter Bootstrap) for entering image paths. The workflow is like this:
User is editing something in the contenteditable div and wants to insert an image
User clicks the image button, the modal window opens
User enters some URL into the input field and hit the enter key
Now I'm trying to focus() back to the contenteditable div. Unfortunately it seems not to be focussed, because things like document.execCommand() don't work.
In other words:
How can I bring back the focus() to the contenteditable div after being in an input field?
I have seen a couple of solutions for that, some with big scripts doing some Range/Selection-stuff, but I'm sure there is a much simpler solution for this...
Anyone?

Cannot click Submit button on Selenium IDE

I am having trouble getting Selenium IDE to click the Submit button on one of my webforms after having selenium open and fill out the form. I am using the clickAndWait command and identifying the button by its ID:
<td>clickAndWait</td>
<td>id=ctl00_ContentPlaceHolder1_OSVFHResults_btSave</td>
<td></td>
Interestingly, if I write a script that simply opens the form and clicks the submit button without filling it out, I am not having any problems. My problem is coming specifically after I've asked Selenium to fill out the form. Additionally, if I try to manually click the submit button, it doesn't work if the Selenium script to fill out the form was run before my manual input. If I manually open and fill out the form, I have no problems clicking submit, and Selenium works for all of the other form's submit buttons on the site. Anyone have any ideas?
Instead of filling form with type command you can try typeKeys one. It simulates keystroke events on the specified element, as though you typed the value key-by-key and probably enable your submit button.
It sounds like some javascript event unrelated to click() (such as mouseover or onkeydown) is attached to one or more of the form fields and is responsible for enabling the submit button.
You'd have to look at which exact events are being fired, either by looking at the source with something like firebug, or by using a javascript debugger. Then modify your Selenium script to make sure the same events get triggered.
After type the values in the form just try "ClickAtandWait" instead of "clickandWait"..i also face the problem once and it gave hands once..
selenium.clickAtandWait("locator", "position");
if you know the exact "position" just put it, otherwise leave it as an empty string.

How do I click a hyper link in a web browser automatically in vb.net?

Let's say my browser goes to a page similar to this one below ..
Picture Is Here
On this page there is a hyper link called 'Click Here' .. when I click it, it opens another window with things in it.
How can I click this hyper link in vb.net automatically without me clicking on it with the mouse, and how do I open the window in a second web browser ?
We can assume that the first browser is called (WebBroswer1 ) and the second one is called (WebBrower2).
I know how to perform buttons clicks and do raise the 'OnClick' Events, but I don't know how to do it with a hyper links.
Please any help will be appreciated, I look forward for solutions.
If you have jquery available in your webpage you can do something like
Say you have Click Here
you can programatically trigger the click of that link by doing:
$("#webbrowser2").trigger("click");
HTH