Welcome Guest Search | Active Topics | Sign In | Register

Webbrowser Control Automation Options
Michael George
Posted: Monday, May 19, 2014 4:28:42 PM
Rank: Newbie
Groups: Member

Joined: 5/14/2014
Posts: 8
I am trying to replace the VS WebBrowser control with your EO WebBrowser control. I am using it to automate the login procedure for an outside system our sales reps use. I am successful in entering the username and password however I cannot properly emulate the click on submit button. I have tried submitting the form via EvalScript but the page does not behave properly when I do that. I need to emulate the click. The submit button is an <input type="image"> which does not have an id or name attribute so I cannot use getElementByID or getElementByName. In the VS Webbrowser control I would getElementsByTagName and loop through them until I found a match based on a combination of attribute values. Once I found the element I was looking for I would invoke the click event.

The element I need to find and then "click" is tagged as follows:

<input type="image" src="/images/btn-submitGreenSmall.gif" alt="Submit">

I would greatly appreciate if someone could help me with a code snippet demonstrating how I can "find" this element and then invoke a click.
eo_support
Posted: Monday, May 19, 2014 11:28:36 PM
Rank: Administration
Groups: Administration

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

The most reliable way for you to do auto login is to capture the authentication cookies and then attach the cookie through BeforeRequestLoad event. However it is also possible for you to do it with EvalScript. In order to do it with EvalScript, your image element usually needs to have an id, the code will be something like this:

Code: C#
WebView1.EvalScript("document.getElementById('your_image_button_id').click();");


This will have the same effect as user clicking on the image at position (0, 0) thus submitting the form.

Thanks!


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.