0

Error: Couldn't sign you in This browser or app may not be secure. Learn more Try using a different browser. If you’re already using a supported browser, you can refresh your screen and try again to sign in.

2FA is OFF and Less Secure Account is ON, already tried the same script with FireFox browser

Chrome: 90.0.44 and Python=3.9.5

Code:

from selenium import webdriver

video_url = 'https://www.youtube.com/watch?v=0WVDKZJkGlY'
driver = webdriver.Chrome()

driver.get('https://accounts.google.com/signin/v2/identifier?hl=en')

# click sign in button
# driver.find_element_by_xpath(
#     '/html/body/ytd-app/div/div/ytd-masthead/div[3]/div[3]/div[2]/ytd-button-renderer/a/tp-yt-paper-button').click()

# Email Field
driver.find_element_by_xpath(
    '/html/body/div[1]/div[1]/div[2]/div/div[2]/div/div/div[2]/div/div[1]/div/form/span/section/div/div/div[1]/div/div[1]/div/div[1]/input').send_keys('[email protected]')

# Next Button
driver.find_element_by_xpath(
    '/html/body/div[1]/div[1]/div[2]/div/div[2]/div/div/div[2]/div/div[2]/div/div[1]/div/div/button/div[2]').click()
sleep(1)

# Password Field
driver.find_element_by_xpath(
    '/html/body/div[1]/div[1]/div[2]/div/div[2]/div/div/div[2]/div/div[1]/div/form/span/section/div/div/div[1]/div[1]/div/div/div/div/div[1]/div/div[1]/input').send_keys('Careermaniaa@SagarYadav1908')

# Login Button
driver.find_element_by_xpath(
    '/html/body/div[1]/div[1]/div[2]/div/div[2]/div/div/div[2]/div/div[2]/div/div[1]/div/div/button/div[2]').click()

4
  • What is the URL that you are using ? Please share code that you tried Commented May 27, 2021 at 6:56
  • @cruisepandey code is added Commented May 27, 2021 at 7:06
  • is chrome mandatory or you can switch to any browser ? Commented May 27, 2021 at 7:25
  • no, it is not mandatory. I can switch Commented May 27, 2021 at 7:30

2 Answers 2

1

try this:

driver.find_element_by_xpath('//input[@id="identifierId"]').send_keys(yourEmail)
driver.find_element_by_xpath('//div[@id="identifierNext"]').click()
driver.find_element_by_xpath('//input[@class="whsOnd zHQkBf"]').send_keys(yourPass)
driver.find_element_by_xpath('//div[@id="passwordNext"]').click()
Sign up to request clarification or add additional context in comments.

Comments

0

Google is able to detect that your using a webdriver, you can use undetected_chromedriver to stop google from detecting you.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.