Jump to content

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


Recommended Posts

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?

Link to comment
Share on other sites

  • Moderators

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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

  • Moderators

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

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...