Jump to content

Login to Gmail from Browser


Ram
 Share

Recommended Posts

I have a few sets of Gmail usernames and passwords. I would like to put this in Excel and login automatically and then logout. 
So, to do this, I tried the following:

 

include <IE.au3>

$sEmail = 'myemail@gmail.com'
$sPassword = 'mypassword'

$oIE = _IECreate("https://accounts.google.com/v3/signin/identifier?continue=https%3A%2F%2Fmail.google.com%2Fmail%2Fu%2F0%2F&emr=1&followup=https%3A%2F%2Fmail.google.com%2Fmail%2Fu%2F0%2F&ifkv=AXo7B7XEtHvS8E8suL3AtSORCeEhHobAax8QWPWZFECFcts4FxgLwEO_NyB8UzC88KmQlJgseWt6Ww&osid=1&passive=1209600&service=mail&flowName=GlifWebSignIn&flowEntry=ServiceLogin&dsh=S-703882919%3A1692811483921521#inbox")

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')
    If IsObj($oSpans) Then
        For $oSpan In $oSpans
            If StringInStr($oSpan.innerText, 'Next') Then
                Sleep(5000) ; Add a delay of 5 seconds before clicking "Next"
                $oParentElement = $oSpan.parentElement
                _IEAction($oParentElement, 'click') ; Click the parent element of the span
                ExitLoop
            EndIf
        Next
    EndIf
EndFunc

The username is entered properly, but the script is not able to find the "Next" text button. So the script keeps giving the below warning and error message. How to fix this? 

 

Quote

--> IE.au3 V3.1-0 Warning from function _IEFormElementGetObjByName, $_IESTATUS_NoMatch
--> IE.au3 V3.1-0 Warning from function _IEFormElementGetObjByName, $_IESTATUS_NoMatch
--> IE.au3 V3.1-0 Warning from function _IEFormElementGetObjByName, $_IESTATUS_NoMatch
--> IE.au3 V3.1-0 Error from function _IEFormElementSetValue, $_IESTATUS_InvalidDataType
--> IE.au3 V3.1-0 Warning from function _IEGetObjById, $_IESTATUS_NoMatch (view_container)
--> IE.au3 V3.1-0 Error from function _IETagNameGetCollection, $_IESTATUS_InvalidDataType


Let me know!


Thanks!

Link to comment
Share on other sites

  • Moderators

Ram,

And from where did you get this list and why are you looking to login to them all? 

M23

PS: Mod hat on - everyone else stay out please. 

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

 

Link to comment
Share on other sites

I am trying to get it from an Excel file, but for now, I want to try it out with one email.

Recently, Google sent an email about the Google account Inactivity policy; I think if a particular account is not logged in before December 1st they will deactivate the account.

I have like 10 different accounts + I have my workspace account to manage hence I am trying to do faster and not waste time by logging in, etc.  Tried it using Python but I wasn't able to login further because of automation detection. 

Thanks!

Link to comment
Share on other sites

For real? To log in a single account it takes like one minute. For ten accounts it's like 10 minutes but you try to automate this instead without having the required knowledge. I don't know man, it's sketchy. Not what a normal people will do. Since you posted the question you could have log in hundreds of accounts manually.  :rolleyes:

When the words fail... music speaks.

Link to comment
Share on other sites

  • Moderators

Andreik,

Which bit of "everyone else stay out please" did you not understand? Please do not do this again.

Ram,

Not a good enough explanation. You only need to activate a Google account every year or so - for 10 personal accounts I do not see this as an onerous task , so you just do it manually.

Thread closed.

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

 

Link to comment
Share on other sites

  • Developers

This is actually a common item of the OP when looking at the history for quite some time now!

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

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