我发现了一种可以使用python3和selenium3登录到Google帐户的方法。
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.firefox.options import Options
from selenium.webdriver.firefox.options import Log
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait
self.driver = webdriver.Firefox()
self.driver.get('https://accounts.google.com/signin/v2/identifier?hl=en&continue=https://news.google.com/')
# login into Google with Selenium
email_str = 'your_email'
password_str = 'yourpwd'
self.driver.find_element_by_id("identifierId").send_keys(email_str)
self.driver.find_element_by_id("identifierNext").click()
password = WebDriverWait(self.driver, 3).until(
EC.presence_of_element_located((By.XPATH, "//input[@type='password']" )))
password.send_keys(password_str)
element = self.driver.find_element_by_id('passwordNext')
self.driver.execute_script("arguments[0].click();", element)
..并且您已登录。
答案 0 :(得分:0)
类似的问题也在这里 Automating GMAIL login using Python-Selenium
简单地说,您可以添加
import time
和
time.sleep(1)
输入用户名后