Jump to content

Recommended Posts

Posted

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>
Posted

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

  • Moderators
Posted

YogiBear,

We do not allow for Bypassing of security measures - log-in and security dialogs

And this is not a dialog - it is a normal page and so quite legal. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Posted (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

thankyou 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 by codernoobx
Posted

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.
Posted

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
Posted

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.

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
  • Recently Browsing   0 members

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