Sign in to follow this  
Followers 0
QuestionableSuspect

_IEAction click issue - JavaScript related?

7 posts in this topic

#1 ·  Posted

Hi All!

I am new to the forums and AutoIT in general. I am attempting to write a script to fill out a login form for Google Accounts in order to allow for a seamless connection to the account without having to expose the password to the end user. Before I even go any further, is this considered bypassing a security measure? Definitely don't want to be breaking the rules... :sweating:

There is no automated registration or anything: the goal is to navigate to the page (https://accounts.google.com/Login#identifier), set the username value, click the next button, set the password value, then click the signin button.

 

Thank you!

Share this post


Link to post
Share on other sites



#2 ·  Posted

I am using the #identifier page for form consistency so that the username can be input every time, to avoid having issues where a personal account username gets pulled in through the cache

My script gets to the point where it inserts the TargetUsername then nothing happens after that. I want it to click the "Next" button so the form updates to enter the password, however no matter what I do I can't get the click to register. I suspect it is something to do with the javascript not triggering on the "click", but I am not sure. Any help would be greatly appreciated!

My code (the TargetUsername/Password variables have been omitted for privacy purposes):

Local $o_form = _IEFormGetObjByName ($oIE, "gaia_loginform")

Local $o_user = _IEFormElementGetObjByName ($o_form, "Email")
Local $o_password = _IEFormElementGetObjByName ($o_form, "Passwd")
Local $o_next = _IEFormElementGetObjByName ($o_form, "signIn", 0)
Local $o_signin = _IEFormElementGetObjByName ($o_form, "signIn", 1) 

; Navigate to the page, set the username value, click the next button, set the password value, then submit the form
_IENavigate($oIE, "https://accounts.google.com/Login#identifier")
_IELoadWait($oIE)
Sleep(500)
_IEFormElementSetValue($o_user, $TargetUsername)
Sleep(200)
_IEAction($o_next, "click")
Sleep(200)
_IEFormElementSetValue($o_password, $TargetPassword)
Sleep(200)
_IEAction($o_signin, "click")

 

I was able to adjust it to Send("{TAB}") to the next button then Send("{ENTER}") but I am still wondering why the click wouldn't work? My thought was that it wasn't causing the javascript to register, the page doesn't use an "onclick" javascript, it looks to use a listener that isn't picking up the _IEAction "click"...

If any more information is needed please let me know!

Share this post


Link to post
Share on other sites

Are you sure you get a correct object ?

$o_signin

You can check with outputting $o_signin.InnerHTML
 

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Hi @Juvigy! Thanks for the follow up :) I can't seem to get the .InnerHTML to return anything other than "0" in a MsgBox, however I tried below (the IEFormElementGetValue) and that returns the correct value for that element, so I think it is picking it up correctly?

Local $o_form = _IEFormGetObjByName ($oIE, "gaia_loginform")
    
Local $o_user = _IEFormElementGetObjByName ($o_form, "Email")
Local $o_password = _IEFormElementGetObjByName ($o_form, "Passwd")
Local $o_next = _IEFormElementGetObjByName ($o_form, "signIn", 0)
Local $o_signin = _IEFormElementGetObjByName ($o_form, "signIn", 1)

    ; Set username value, tab to the next button and hit Enter, set the password value, then tab to the sign in button and hit enter

_IELoadWait($oIE)           

Sleep(100)
_IEFormElementSetValue ($o_user, $TargetUsername)
Sleep(100)

MsgBox(4096,"test", _IEFormElementGetValue($o_next))

 

Edited by QuestionableSuspect

Share this post


Link to post
Share on other sites

The form doesn't just submit, it uses the signIn element twice, the first one being the "next" button which, when clicked, causes the second section of the form to slide in to place with the password and actual "sign in" button.

Looking at the form it appears that some listener is activated on click which causes the form to progress to the next set of prompts--is there any reason the _IEAction, "click" would not cause this to trigger properly?

Share this post


Link to post
Share on other sites

I'm pretty sure Google does some odd JS to make their login page. They check the username separately from the password. This might make it a little more complicated to submit a form all at once.


UHJvZmVzc2lvbmFsIENvbXB1dGVyZXI=

Share this post


Link to post
Share on other sites

This code worked fine in my limited testing.

#include <IE.au3>

Local $email = 'xxxxxxxxxxxx@gmail.com'
Local $pwd   = 'yyyyyyyyyyyy'

Local $oIE = _IECreate()
_IENavigate($oIE, "https://accounts.google.com/Login#identifier")

Local $o_form = _IEFormGetObjByName ($oIE, "gaia_loginform")

Local $o_user = _IEFormElementGetObjByName ($o_form, "Email")

_IEFormElementSetValue($o_user, $email)

Local $o_next = _IEFormElementGetObjByName ($o_form, "signIn", 0)
_IEAction($o_next, 'click')

Sleep(2000)

Local $o_password = _IEFormElementGetObjByName ($o_form, "Passwd")
_IEFormElementSetValue($o_password, $pwd)
_IEFormSubmit($o_form)

The Sleep() was added for observation purposes. However, I didn't test without it.

Share this post


Link to post
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
Sign in to follow this  
Followers 0