Welcome Guest Search | Active Topics | Sign In | Register

EO Webbrowser - click image on a web page Options
Willy
Posted: Saturday, February 7, 2015 5:12:44 AM
Rank: Member
Groups: Member

Joined: 9/27/2014
Posts: 15
Hi Support,

I'm trying to click a button (image) on a web page, but I can not.
Before I post the data of user name and password as follows, and it works:

Code: Visual Basic.NET
WebView1.EvalScript("document.getElementsByName('userName')[0].value = " & "'" & user & "'" & ";")
        WebView1.EvalScript("document.getElementsByName('password')[0].value = " & "'" & pw & "'" & ";")


Then I try to run the clicks in several ways but without success:
Code: Visual Basic.NET
WebView1.EvalScript("document.getElementById('LoginFom_button_value_login').Click();")


I thought of a problem of focus and so I tried to first insert the following instructions:
Code: Visual Basic.NET
WebView1.EvalScript("document.getElementById('login-form').Submit();")

But it does not solve the problem

The code of the button in the web page is as follows:
Code: HTML/ASPX
<input type="image" id="LoginFom_button_value_login"
                           name="action:Login_executeLogin" value="Login"
                           src="https://www.sitexyz.com/btn.png"
                           alt="Login"/>


How I can click this button (image)?

Thank You
eo_support
Posted: Saturday, February 7, 2015 3:55:23 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,196
Hi,

Please try to test the page/script in Google Chrome browser first. If the same code works inside Google Chrome browser, it should work inside EO.WebBrowser.

Thanks!
Willy
Posted: Saturday, February 7, 2015 8:21:51 PM
Rank: Member
Groups: Member

Joined: 9/27/2014
Posts: 15
Yes, the site page work correctly in google chrome, my problem is that I can not seem to automate auto login in EO.Webbrowser because I can not click the button image that you need to login.
After many attempts I managed to make the click in its operation as follows:

Work fine:
Code: Visual Basic.NET
Dim doc As EO.WebBrowser.DOM.Document = WebView1.GetDOMWindow().document
doc.getElementById("LoginFom_button_value_login").InvokeFunction("click")


Why with the following code does not generate the click?


Don't work:
Code: Visual Basic.NET
WebView1.EvalScript("document.getElementByInputType('image')[0].click();")


Don't work:
Code: Visual Basic.NET
WebView1.EvalScript("document.GetElementById('LoginFom_button_value_login').click();")


Don't work:
Code: Visual Basic.NET
WebView1.EvalScript("document.GetElementByName('action:Login_executeLogin')[0].click();")


What is the error?

Thank you
eo_support
Posted: Saturday, February 7, 2015 9:22:40 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,196
Hi,

You need to run the same code you are trying to call EvalScript with in your page to find out why your JavaScript does not work. For example, you can try to run "document.getElementByInputType('image')[0].click()" in Google Chrome and see if that works. If that doesn't work when you call it there, then your JavaScript code is wrong. In that case you need to resolve the issue yourself because obviously we are not in a position to troubleshoot JavaScript code for you. If that works fine, you can try to isolate the problem into a test project/page and send the test project/page to us. We will then take a look as soon as we have them.

Thanks!
Willy
Posted: Tuesday, February 10, 2015 7:01:07 PM
Rank: Member
Groups: Member

Joined: 9/27/2014
Posts: 15
Thanks you, I'll try


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.