Cannot Sign In Google using Selenium

Viewed 50

I'm trying to sign in into google using Selenium. Unfortunately it stops me right after I insert the e-mail. I read through the internet that is a common issue and I tried everything like:

  1. use Firefox

  2. disable 2-key verification

  3. allow less secure app

  4. and others (I cannot remember because this problem has already taken me 6 hours with no solution, I'm going crazy).

HELP ME!

What can I do?

this is my code:

from selenium import webdriver
from selenium.webdriver.firefox.service import Service
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys

# set the firefox webdrive (THIS WORKS)
FIREFOX_DRIVER_PATH = "C:\\Development\\geckodriver.exe"
s = Service(executable_path=FIREFOX_DRIVER_PATH)
driver = webdriver.Firefox(service=s)

driver.get("*my_site*")

# google log-in (THIS WORKS)
GOOGLE_BUTTON_XPATH = '*my_google_button_xpath*'
google_button = driver.find_element(By.XPATH, GOOGLE_BUTTON_XPATH)
google_button.click()

# email input (THIS WORKS)
EMAIL_INPUT_XPATH = '*my_email_xpath*'
email_input = driver.find_element(By.XPATH, EMAIL_INPUT_XPATH)
email_input.send_keys("*sample_mail@gmail.com*")
email_input.send_keys(Keys.ENTER)


# XXX--------AND NOW I'M STUCK:--------XXX
# COULDN'T SIGN YOU IN
# this browser or app may not be secure

(I'VE ALSO TRIED WITH CHROME and CHROME DRIVER, even though in the code above I use Firefox)

0 Answers
Related