codernoobx Posted April 22, 2013 Share Posted April 22, 2013 I am quiet new to autoit and scripting itself.Kindly look at my code and suggest me a better way to do it.The following code works but when i try to get the form elements by name or type (for eg $fm.name=='email') it fails !!.Also i don't have much knowledge on dom elements ,kindly enlighten me on it related to my code. objective:login to blogger account my code #include <ie.au3> $oIE = _IECreate("https://accounts.google.com/ServiceLogin?service=blogger") _IELoadWait($oIE) $oForm = _IEFormGetObjByName ($oIE, "gaia_loginform") $oFormElements = _IEFormElementGetCollection($oForm) for $fm in $oFormElements if($fm.type=='text') Then _IEFormElementSetValue($fm, "Found You", 0) elseif($fm.type=='password') Then _IEFormElementSetValue($fm, "Found You", 0) elseif($fm.type=='submit') Then _IEFormSubmit($oForm) endif next html source for the form <form novalidate="" id="gaia_loginform" action="https://accounts.google.com/ServiceLoginAuth" method="post"> <input type="hidden" name="service" id="service" value="blogger"> <input type="hidden" name="dsh" id="dsh" value="-2655181513770911851"> <input type="hidden" name="GALX" value="oBUZ5i4i_48"> <input type="hidden" id="pstMsg" name="pstMsg" value="1"> <input type="hidden" id="dnConn" name="dnConn" value=""> <input type="hidden" id="checkConnection" name="checkConnection" value="youtube:491:1"> <input type="hidden" id="checkedDomains" name="checkedDomains" value="youtube"> <input type="hidden" name="timeStmp" id="timeStmp" value=""> <input type="hidden" name="secTok" id="secTok" value=""> <input type="hidden" id="_utf8" name="_utf8" value="☃"> <input type="hidden" name="bgresponse" id="bgresponse" value="js_disabled"> <div class="email-div"> <label for="Email"><strong class="email-label">Email</strong></label> <input type="email" spellcheck="false" name="Email" id="Email" value=""> </div> <div class="passwd-div"> <label for="Passwd"><strong class="passwd-label">Password</strong></label> <input type="password" name="Passwd" id="Passwd"> </div> <input type="submit" class="g-button g-button-submit" name="signIn" id="signIn" value="Sign in"> <label class="remember" onclick=""> <input type="checkbox" name="PersistentCookie" id="PersistentCookie" value="yes"> <strong class="remember-label"> Stay signed in </strong> </label> <input type="hidden" name="rmShown" value="1"> </form> Link to comment Share on other sites More sharing options...
Bert Posted April 22, 2013 Share Posted April 22, 2013 Welcome to the forum. We are glad you are here but what you are asking for is against our forum rules: http://www.autoitscript.com/forum/index.php?app=forums&module=extras§ion=boardrules We do not allow for Bypassing of security measures - log-in and security dialogs to be discussed in the forum. Sorry. The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
jdelaney Posted April 22, 2013 Share Posted April 22, 2013 (edited) Login pages are ok...you only need one '=', not two, in the if statements. I'd use the ID's, and _IE* functions _IEGetObjById Edited April 22, 2013 by jdelaney IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. Link to comment Share on other sites More sharing options...
Bert Posted April 22, 2013 Share Posted April 22, 2013 The thread has been reported to a moderator. Let them decide. The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
codernoobx Posted April 22, 2013 Author Share Posted April 22, 2013 i am so sorry ,my bad i did not read the rules.but what my scipt does is only fills in the login /password fields .It does not bypass any security measures Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted April 22, 2013 Moderators Share Posted April 22, 2013 YogiBear,We do not allow for Bypassing of security measures - log-in and security dialogsAnd this is not a dialog - it is a normal page and so quite legal. M23 Bert 1 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...
codernoobx Posted April 22, 2013 Author Share Posted April 22, 2013 (edited) Login pages are ok...you only need one '=', not two, in the if statements.I'd use the ID's, and _IE* functions_IEGetObjByIdthankyou for valueable input .btw but it still works .I tried _IEGetObjById but failed could you test it .i just looked up the help file for operators and if i am not wrong am comparing string variables so i need to use '=='. Edited April 22, 2013 by codernoobx Link to comment Share on other sites More sharing options...
jdelaney Posted April 22, 2013 Share Posted April 22, 2013 Use _IEAttach first, to return the dom object, and pass that into the function: #include <IE.au3> _IEGetObjById(ByRef $o_object, $s_Id) don't forget the include line. F1 will be your friend, click on any function in scite, and it will bring up the help file, with an example: #include <IE.au3> Local $oIE = _IE_Example("basic") Local $oDiv = _IEGetObjById($oIE, "line1") ConsoleWrite(_IEPropertyGet($oDiv, "innertext") & @CRLF) IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. Link to comment Share on other sites More sharing options...
codernoobx Posted April 22, 2013 Author Share Posted April 22, 2013 Use _IEAttach first, to return the dom object, and pass that into the function: #include <IE.au3> _IEGetObjById(ByRef $o_object, $s_Id) don't forget the include line. F1 will be your friend, click on any function in scite, and it will bring up the help file, with an example: #include <IE.au3> Local $oIE = _IE_Example("basic") Local $oDiv = _IEGetObjById($oIE, "line1") ConsoleWrite(_IEPropertyGet($oDiv, "innertext") & @CRLF) could you tell me if there is any difference between creating an ie object and attaching one Link to comment Share on other sites More sharing options...
jdelaney Posted April 22, 2013 Share Posted April 22, 2013 Look through the help file. On the index tab, search for _IE. I would ask you familiarize yourself with what is available. _IECreate when you have no browser started, _IEattach when browser is already running. IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. Link to comment Share on other sites More sharing options...
Bert Posted April 22, 2013 Share Posted April 22, 2013 YogiBear,And this is not a dialog - it is a normal page and so quite legal. M23This is great news. I always thought it was a blanket ban. Thanks for the clarification.Would simply passing the ID and password work in the url string? I haven't tested that yet but logic would say yes. The Vollatran project My blog: http://www.vollysinterestingshit.com/ 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