Kimbo Posted June 7, 2007 Share Posted June 7, 2007 Hi, I am trying to automate a login to a login page as is shown in the picture, I have the following script but when it is run all that happens is the login page is displayed. Script: #include <IE.au3> $g_szVersion = "AutoLogin Script 1.1" If WinExists($g_szVersion) Then Exit ; It's already running AutoItWinSetTitle($g_szVersion) ; Create a browser window and navigate to login page $oIE = _IECreate ("http://10.61.5.200") Sleep(2000) ; Send Keystrokes Send("{TAB}") Send("User") Send("{TAB}") Send("Password") Send("{TAB}") Send("{ENTER}") ; Finished I have tried to just emulate the keystrokes that would be made at the screen but nothing is happening, I have attached a picture of the screen as it appears. The login screen is a CGI script I think. Any help would be appreciated Link to comment Share on other sites More sharing options...
Moderators big_daddy Posted June 7, 2007 Moderators Share Posted June 7, 2007 Test the example script for _IEFormGetObjByName() in the help file and try to understand what it is doing. If you use Firefox then use the Web Developer Toolbar, else use MODIv2 to examine the form information and make the appropriate changes to the example script to fit your needs. Link to comment Share on other sites More sharing options...
Kimbo Posted June 8, 2007 Author Share Posted June 8, 2007 Test the example script for _IEFormGetObjByName() in the help file and try to understand what it is doing. If you use Firefox then use the Web Developer Toolbar, else use MODIv2 to examine the form information and make the appropriate changes to the example script to fit your needs.Thanks for your reply, unfortunately I am remote to this site and cannot check for the source behind this page, I think its class type is Internet Explorer_Server1.Is it possible to get focus on the page by using the text in the header, I have tried a few things but have not had much luck, the problem being I have to keep sending the scripts to the person who is using it on their internal network, so it is a bit of trial and error cause I cant test it.Many Thanks Link to comment Share on other sites More sharing options...
narayanjr Posted June 8, 2007 Share Posted June 8, 2007 (edited) #include <IE.au3> $g_szVersion = "AutoLogin Script 1.1" If WinExists($g_szVersion) Then Exit ; It's already running AutoItWinSetTitle($g_szVersion) ; Create a browser window and navigate to login page $oIE = _IECreate ("http://10.61.5.200") Sleep(2000) $X = @DesktopWidth / 2 $Y = @DesktopHeight / 2 MouseClick("left",$X,$Y,1,1) ; Send Keystrokes Send("{TAB}") Send("User") Send("{TAB}") Send("Password") Send("{TAB}") Send("{ENTER}") ; Finished that way it would click in the center of the screen which from what the screenshot looks like it would always give focus to the login page just a thought Edited June 8, 2007 by narayanjr Link to comment Share on other sites More sharing options...
Sangeeta25Jagdish Posted June 8, 2007 Share Posted June 8, 2007 Here is the Code for the login #include <IE.au3> ; Create a browser window and navigate to webaddress $url="Put Ur URL address here" $oIE = _IECreate ($url) WinSetState("title of window", "Text of the window ",@SW_MAXIMIZE) ; get pointers to the login form and username, password and signin fields $o_form = _IEFormGetObjByName ($oIE, "form1") $o_login = _IEFormElementGetObjByName ($o_form, "txtUserName") ;User Name Text Box $o_password = _IEFormElementGetObjByName ($o_form, "txtPassword"):Password Text Box $o_go = _IEFormElementGetObjByName ($o_form, "btnLogin");"Go" button $username = "Enter user name" $password = "Enter Passwordl" ; Set field values and submit the form _IEFormElementSetValue ($o_login, $username) _IEFormElementSetValue ($o_password, $password) _IEAction ($o_go, "click") _IELoadWait($oIE,1000) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now