Sign in to follow this  
Followers 0
shaolin

Scenario: How Do I Type Text In A Webpage Field?

13 posts in this topic

I want to automate logging into a website.

The website changes all the time and the login field moves around the webpage so I can't use the mousemove command and use the same coordinates.

Tabbing over to the field also doesn't work because there may be a new picture file near the login field so the number of tab moves I need to make always changes.

Any advice on what I should do?

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

If you could post the source of the webpage between these <form & </form> we should be able to help you out.

Edited by big_daddy

Share this post


Link to post
Share on other sites

iverson, i can do basic scripting through autoit3 but that stuff you linked to is waaay over my head. is there a simple solution to logon to the site that i just posted?

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Try this:

#include <IE.au3>

$oIE = _IECreate()
_IENavigate($oIE, "http://www.lexisnexis.com/lawschool/")

; get pointers to the login form and username and password fields
$o_form = _IEFormGetObjByName($oIE, "frmLSPLogin")
$o_login = _IEFormElementGetObjByName($o_form, "txtLoginID")
$o_password = _IEFormElementGetObjByName($o_form, "txtPassword")

; Set field values and submit the form
_IEFormElementSetValue($o_login, "test"); Make change here for username
_IEFormElementSetValue($o_password, "test"); Make change here for password
_IEFormSubmit($o_form)

You will need the IE.au3 UDF also.

Edited by big_daddy

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

you might try this code:

#include <ie.au3>
$user = "username here"
$pass = "Password here"
$oIE = _IECreate()
WinSetState("about:blank - Microsoft Internet Explorer", "", @SW_MAXIMIZE)
_IENavigate($oIE, "http://www.lexisnexis.com/lawschool/")
WinWaitActive("LexisNexis for law Schools", "")
$o_form = _IEFormGetObjByName($oIE, "frmLSPLogin")
$o_login = _IEFormElementGetObjByName($o_form, "txtLoginID")
$o_password = _IEFormElementGetObjByName($o_form, "txtPassword")


_IEFormElementSetValue($o_login, $user)
_IEFormElementSetValue($o_password, $pass)
_IEFormSubmit($o_form)

im no expert so i dunno

i noticed the submit button has a javascript action assigned to it so the _IEFormSubmit() might not work.

Edited by anyday

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

WinWaitActive("LexisNexis for law Schools", "")
You don't need that part, _IENavigate() does this already. Edited by big_daddy

Share this post


Link to post
Share on other sites

k to bigdaddy's code i got the error:

Line 776 (File "C:\IE.au3"):

If IsObj($o_object.elements) Then

If IsObj($o_object.e^ERROR

Error: Unable to parse line.

Ok.

Share this post


Link to post
Share on other sites

k to bigdaddy's code i got the error:

Line 776 (File "C:\IE.au3"):

If IsObj($o_object.elements) Then

If IsObj($o_object.e^ERROR

Error: Unable to parse line.

Ok.

This is probably due to you not having the beta version.

Share this post


Link to post
Share on other sites

you do have the ie.au3 udf right?

Share this post


Link to post
Share on other sites

i just installed the beta version, yes i have the ie.udf, and man i still got the same error...any ideas?

Share this post


Link to post
Share on other sites

to install the beta is not enough... you must run the script USING the beta. by default script run with release. use "program files" beta shortcut to autoit3.exe beta and choose the script to run. Or install SCITE distrib and use ALT + F5 to run script with beta.

Yeah what he said, or what I always do is toggle the beta defs.

Program Files-->AutoIT v3-->beta-->Toggle AU3 Beta

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0