Jump to content

Recommended Posts

Ram

Hi,

I was using the below Gmail script that used to login to my Gmail and password automatically using IE. After the new type of login method in Gmail. I am not able to do it using the below code.
Has anyone tried on the auto login script for Gmail for latest Gmail login method?

Global $oIE =_IECreate ("https://accounts.google.com/ServiceLogin?sacu=1&continue=http%3A%2F%2Fmail.google.com%2Fmail%2F%3Fpc%3Dtopnav-about-en&hl=en&service=mail")

    local $username = _IEGetObjByName ($oIE, "Email")
    Local $password = _IEGetObjByName ($oIE, "Passwd")

    Local $Email_button = _IEGetObjByName ($oIE, "Email")
    Local $Signin_button = _IEGetObjByName ($oIE,"signIn")

    _IEFormElementSetValue ($username, "mygmailaddress@gmail.com")     
    _IEFormElementSetValue ($password, "mygmailpassword")               

    _IEAction ($Email_button, "click")
    _IEAction ($Signin_button, "click")

 

if so can someone help me with this?

Thanks!

Share this post


Link to post
Share on other sites
Andreik

This should work fine:

#include <IE.au3>

$sEmail = 'myemail'
$sPassword = 'mypassword'

$oIE = _IECreate('https://gmail.com')
GMailSubmitFormElement($oIE,'identifier',$sEmail)
GMailSubmitFormElement($oIE,'password',$sPassword)

Sleep(10000)

_IEQuit($oIE)

Func GMailSubmitFormElement($oIE,$sElement,$sValue,$iTimeout=10, $iDelay=1)
    $Timer = TimerInit()
    Do
        $oForm = _IEFormGetCollection($oIE,0)
        $oElement = _IEFormElementGetObjByName($oForm,$sElement)
        Sleep($iDelay * 1000)
    Until IsObj($oElement) Or TimerDiff($Timer) >= $iTimeout * 1000
    _IEFormElementSetValue($oElement,$sValue)
    $oViewContainer = _IEGetObjById($oIE,'view_container')
    $oSpans = _IETagNameGetCollection($oViewContainer,'span')
    For $oSpan In $oSpans
        If $oSpan.innerHTML = 'Next' Then
            _IEAction($oSpan,'click')
            ExitLoop
        EndIf
    Next
EndFunc

 


When the words fail... music speaks

Share this post


Link to post
Share on other sites
MJ36

Unfortunately, the above formula does not work for me ;/ 

image.thumb.png.018878b89678e34b008596384372cb78.png

 

Share this post


Link to post
Share on other sites
Andreik

Replace

If $oSpan.innerHTML = 'Next' Then

with

 

If $oSpan.innerHTML = 'Dalej' Then

When the words fail... music speaks

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

×