mjoshi Posted December 25, 2011 Share Posted December 25, 2011 Hi , I have written this small program to log in to GMAIL; #include <IE.au3> Local $oUser, $oPass, $oSubmit, $oInput $oIE = _IECreate ("www.gmail.com") _IELoadWait($oIE) If WinExists("Gmail: Email from Google") Then WinSetState("Gmail: Email from Google", "", @SW_MAXIMIZE) ;get the htm source Local $oInputs = _IETagNameGetCollection($oIE, "input") ;loop through elements and get the names of the text fields for user and pass For $oInput In $oInputs If $oInput.type = "text" And $oInput.name = "Email" Then $oInput.value = "XXXXXXX" If $oInput.type = "password" And $oInput.name = "Passwd" Then $oInput.value = "XXXXXXXX" Sleep(1200) If $oInput.type = "checkbox" And $oInput.name = "PersistentCookie" Then Send("{SPACE}") Sleep(1200) If $oInput.type = "submit" And $oInput.name = "signIn" Then _IEAction($oInput, "click") Next EndIf Send("{ENTER}") But Somehow, the checkbox is not getting ticked. I tried various formations like : If $oInput.type = "checkbox" And $oInput.name = "PersistentCookie" Then _IEAction($oInput, "click") and If $oInput.type = "checkbox" And $oInput.name = "PersistentCookie" Then $oInput.value = "yes"/"True" But it is not working. Can someone let me know, what I am missing? Link to comment Share on other sites More sharing options...
mjoshi Posted December 25, 2011 Author Share Posted December 25, 2011 Can some1 help please! Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 25, 2011 Moderators Share Posted December 25, 2011 mjoshi, Please do not bump your posts within 24 hours. Remember this is not a 24/7 support forum - those who answer are only here because they like helping others and have some time to spare. You just have to wait until someone who knows something about your particular problem, and is willing to help, comes online. Be patient and someone will answer eventually. And it is Christmas Day you know! M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
mjoshi Posted December 25, 2011 Author Share Posted December 25, 2011 My Apologizes! Marry Christmas to all!!!! Link to comment Share on other sites More sharing options...
ElFuego Posted December 25, 2011 Share Posted December 25, 2011 (edited) Hey mjoshi Please put your code into [ autoit ] tags, otherwise my eyes bleed I honestly can't help you because i think coders should use Firefox anyway, and i'm excited of the FF.au3 library, so you could send javascript commands to the browser ! Maybe the IE functions of AutoIt have something like that too. Edited December 25, 2011 by ElFuego My scripts: Logfile Snippet Link to comment Share on other sites More sharing options...
mjoshi Posted December 25, 2011 Author Share Posted December 25, 2011 (edited) Hey mjoshi Please put your code into [ autoit ] tags, otherwise my eyes bleed #include <IE.au3> Local $oUser, $oPass, $oSubmit, $oInput $oIE = _IECreate ("www.gmail.com") _IELoadWait($oIE) If WinExists("Gmail: Email from Google") Then WinSetState("Gmail: Email from Google", "", @SW_MAXIMIZE) ;get the htm source Local $oInputs = _IETagNameGetCollection($oIE, "input") ;loop through elements and get the names of the text fields for user and pass For $oInput In $oInputs If $oInput.type = "text" And $oInput.name = "Email" Then $oInput.value = "XXXXXX" If $oInput.type = "password" And $oInput.name = "Passwd" Then $oInput.value = "XXXXXXX" Sleep(1200) If $oInput.type = "checkbox" And $oInput.name = "PersistentCookie" Then Send("{SPACE}") Sleep(1200) If $oInput.type = "submit" And $oInput.name = "signIn" Then _IEAction($oInput, "click") Next EndIf Send("{ENTER}") In the above code Checkbox is not getting ticked, and I feel Even the Submit button is not getting clicked as I have to send the Send("{ENTER}") command at the end Edited December 25, 2011 by mjoshi Link to comment Share on other sites More sharing options...
cageman Posted December 25, 2011 Share Posted December 25, 2011 (edited) i will give you a hint: check the order in which the inputs are found by checking the source. That will explain why the input box is not ticked i think (didn't test it). To check the checkbox i assume you need to use "enable" for IEAction function. check the help documentation. Edited December 25, 2011 by cageman Link to comment Share on other sites More sharing options...
mjoshi Posted December 25, 2011 Author Share Posted December 25, 2011 i will give you a hint: check the order in which the inputs are found by checking the source. That will explain why the input box is not ticked i think (didn't test it). To check the checkbox i assume you need to use "enable" for IEAction function. check the help documentation. Great! That was some great thinking, We seem to be now a step closer, yes the Checkbox was described above the submit button in the source. But sadly, even after changing the sequence(basically removing submit button code line), it still is not working. So my code now looks like : #include <IE.au3> Local $oUser, $oPass, $oSubmit, $oInput $oIE = _IECreate ("www.gmail.com") _IELoadWait($oIE) If WinExists("Gmail: Email from Google") Then WinSetState("Gmail: Email from Google", "", @SW_MAXIMIZE) ;get the htm source Local $oInputs = _IETagNameGetCollection($oIE, "input") ;loop through elements and get the names of the text fields for user and pass For $oInput In $oInputs If $oInput.type = "text" And $oInput.name = "Email" Then $oInput.value = "xxxxxxxxxxxx" If $oInput.type = "password" And $oInput.name = "Passwd" Then $oInput.value = "xxxxxxxxxxx" Sleep(1200) If $oInput.type = "checkbox" And $oInput.name = "PersistentCookie" Then _IEAction($oInput, "enable") Sleep(1200) Next EndIf Send("{ENTER}") But the checkbox is still not ticked. Link to comment Share on other sites More sharing options...
mjoshi Posted December 25, 2011 Author Share Posted December 25, 2011 i will give you a hint: check the order in which the inputs are found by checking the source. That will explain why the input box is not ticked i think (didn't test it).Okay I did some testing, I moved the line of Password field up, and the email field down, but the script was still working!So we are now sure that the sequence of description in the source doesn't matter. 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