Google Login

How to automate Google Account Logins

Tools used to create this software:

Download ready-made .ubot script file: Download

Click the code below to copy it:

on load("Bot Loaded") {
    plugin command("UBot Extension 2.dll", "UBot Extension 2 Set License", "INSERT PLUGIN KEY")
    plugin command("Desktop Automation.dll", "Desktop Automation Set License", "INSERT PLUGIN KEY")
    plugin command("Browser Automation.dll", "Browser Automation Set License", "INSERT PLUGIN KEY")
}
set(#google_username,"INSERT GOOGLE LOGIN EMAIL","Global")
set(#google_password,"INSERT GOOGLE LOGIN PASSWORD","Global")
comment("- profile_name is used to create a local folder with this name containing all cookies and data.
- it is best to use simple names without special characters or spaces.")
set(#profile_name,"INSERT A SIMPLE PROFILE NAME","Global")
comment("- browser_title_after_login must contain the title of the browser window after you successfully logged in manually
- this title text can be different depending on your google account language settings (english = Google Accounts, german = Google-Konto)")
set(#brower_title_after_login,"Google Accounts","Global")
kill all chrome browsers()
run google login()
launch new browser()
define kill all chrome browsers {
    set(#run_command_line,$plugin function("UBot Extension 2.dll", "$command line run", "taskkill /f /im chromedriver.exe 2> nul & ver > nul", "Hidden", "False", "", 0),"Global")
    set(#run_command_line,$plugin function("UBot Extension 2.dll", "$command line run", "taskkill /f /im chrome.exe 2> nul & ver > nul", "Hidden", "False", "", 0),"Global")
    plugin command("Browser Automation.dll", "browser cleaning up", "False")
}
define run google login {
    set(#run_command_line,$plugin function("UBot Extension 2.dll", "$command line run", "START /MAX \"\" \"{$special folder("Program Files")}\\Google\\Chrome\\Application\\chrome.exe\" --profile-directory=\"{#profile_name}\" --credentials_enable_service=false --profile.password_manager_enabled=false https://en.wikipedia.org/wiki/Automation --no-first-run", "Maximized", "False", "", 15),"Global")
    plugin command("Desktop Automation.dll", "app window wait for exist", "Google Chrome", 30, "Contains")
    wait(3)
    plugin command("Desktop Automation.dll", "send keys wait exist window", "Google Chrome", "Chrome_WidgetWin_1", "^(l)", "Mode 1", 0, 100, "Contains")
    wait(0.1)
    plugin command("Desktop Automation.dll", "send keys wait exist window", "Google Chrome", "Chrome_WidgetWin_1", "https://accounts.google.com/ServiceLogin?hl=en&passive=true", "Mode 1", 0, 100, "Contains")
    plugin command("Desktop Automation.dll", "send keys wait exist window", "Google Chrome", "Chrome_WidgetWin_1", "\{ENTER\}", "Mode 1", 0, 100, "Contains")
    wait(3)
    if($plugin function("Desktop Automation.dll", "$app window is exist", #brower_title_after_login, "Contains")) {
        then {
            comment("already logged in!")
        }
        else {
            comment("do google login")
            plugin command("Desktop Automation.dll", "send keys wait exist window", "Google Chrome", "Chrome_WidgetWin_1", #google_username, "Mode 1", 0, 100, "Contains")
            wait(2)
            plugin command("Desktop Automation.dll", "send keys wait exist window", "Google Chrome", "Chrome_WidgetWin_1", "\{ENTER\}", "Mode 1", 0, 100, "Contains")
            wait(3)
            plugin command("Desktop Automation.dll", "send keys wait exist window", "Google Chrome", "Chrome_WidgetWin_1", #google_password, "Mode 1", 0, 100, "Contains")
            wait(2)
            plugin command("Desktop Automation.dll", "send keys wait exist window", "Google Chrome", "Chrome_WidgetWin_1", "\{ENTER\}", "Mode 1", 0, 100, "Contains")
        }
    }
    wait(5)
    if($comparison($plugin function("Desktop Automation.dll", "$app window is exist", #brower_title_after_login, "Contains"),"= Equals","True")) {
        then {
            comment("it works!")
            kill all chrome browsers()
            launch new browser()
        }
        else {
            comment("didn\'t work!")
            kill all chrome browsers()
        }
    }
}
define launch new browser {
    set(#appdata_local_path,$special folder("Application Data"),"Global")
    set(#appdata_local_path,$replace(#appdata_local_path,"\\Roaming","\\Local"),"Global")
    plugin command("Browser Automation.dll", "browser chrome add excluded arguments", "enable-automation")
    plugin command("Browser Automation.dll", "browser chrome add arguments", "--user-data-dir={#appdata_local_path}\\Google\\Chrome\\User Data
--profile-directory={#profile_name}")
    plugin command("Browser Automation.dll", "browser connect", "Chrome", "15,0,15,10", "True", "False", "False")
    plugin command("Browser Automation.dll", "browser navigate", "https://google.com")
}

Was this helpful?