1

I'm trying to automate gmail login with Selenium. Always I'm getting error: "This browser or app may not be secure". First I've tried with the google chrome latest version but that didn't work. So, I'm using undetected_chromedriver with google chrome version 86.0.4240.75, stealth and also using lot of arguments. But still no success. Can anyone help please?

import undetected_chromedriver as uc
from selenium.webdriver.common.by import By
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.chrome.options import Options
import time

from selenium_stealth import stealth

s = Service('chromedriver_linux/chromedriver')
chrome_options = Options()
chrome_options.add_argument("--allow-running-insecure-content")
chrome_options.add_argument("--disable-web-security")
chrome_options.add_argument(f'--user-data-dir="/root/.config/google-chrome/test"')
driver = uc.Chrome(version_main=86, service=s, options=chrome_options)

main_url = "https://accounts.google.com/"

stealth(driver,
        languages=["en-US", "en"],
        vendor="Google Inc.",
        platform="Win32",
        webgl_vendor="Intel Inc.",
        renderer="Intel Iris OpenGL Engine",
        fix_hairline=True,
        )

driver.get(main_url)
time.sleep(5)
driver.find_element(By.XPATH, "//input[@type='email']").send_keys('serazummunirz@gmail.com')
time.sleep(5)
driver.find_element(By.XPATH, "//div[@id='identifierNext']").click()
time.sleep(5)

I'm expecting to bypass the error "This browser or app may not be secure" during the login. And I need to login to gmail directly from gmails login page.

0 Answers0