It is giving an error of could not sign in.
Please Help me
Use this link:
https://accounts.google.com/o/oauth2/v2/auth/oauthchooseaccount?redirect_uri=https%3A%2F%2Fdevelopers.google.com%2Foauthplayground&prompt=consent&response_type=code&client_id=407408718192.apps.googleusercontent.com&scope=email&access_type=offline&flowName=GeneralOAuthFlow
I don't know what's the problem but google has it's own security protocols and it is hard to by pass it.
To use it you must turn off two step verification and other account security. In my case when I tried signing in, for the first 5-6 times it asked me to verify by tapping a number in my smartphone(hope you know what's that), then it is working fine for me.
Now, if you want to avoid error you can use Explicit Wait in selenium.
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as ec
WebDriverWait(driver, 100).until(ec.visibility_of_element_located((By.XPATH, '###')))
#Place the xpath of you element in place of ###
By using this, you can make selenium wait until an element loads and then proceed.
If problem continues to occur, you can use third party sites to sign in, which include stack overflow.
from selenium import webdriver
from time import sleep
username=raw_input("username: ")
password=raw_input("password: ")
driver=webdriver.Chrome('...') #path of your chrome driver
driver.get('https://stackoverflow.com/users/signup')
sleep(3)
driver.find_element_by_xpath('//*[@id="openid-buttons"]/button[1]').click()
driver.find_element_by_id('identifierId').send_keys(username)
driver.find_element_by_id('identifierNext').click()
sleep(3)
driver.find_element_by_name('password').send_keys(password)
driver.find_element_by_id('passwordNext').click()
sleep(2)
driver.get('https://mail.google.com/mail/u/0/#inbox')
Now, you can get any of your URL and continue.