Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/318.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用Python Selenium webdrive登录雅虎电子邮件帐户_Python_Selenium_Selenium Webdriver_Automation_Yahoo - Fatal编程技术网

使用Python Selenium webdrive登录雅虎电子邮件帐户

使用Python Selenium webdrive登录雅虎电子邮件帐户,python,selenium,selenium-webdriver,automation,yahoo,Python,Selenium,Selenium Webdriver,Automation,Yahoo,我需要使用Selenium和Python登录yahoo电子邮件帐户 这是我的密码 from selenium import webdriver from selenium.webdriver.common.keys import Keys driver = webdriver.Firefox() driver.get("https://login.yahoo.com") print driver.current_url logintxt = driver.find_element_by_n

我需要使用Selenium和Python登录yahoo电子邮件帐户

这是我的密码

from selenium import webdriver
from selenium.webdriver.common.keys import Keys

driver = webdriver.Firefox()
driver.get("https://login.yahoo.com")

print driver.current_url

logintxt = driver.find_element_by_name("username")
logintxt.send_keys("email")

pwdtxt = driver.find_element_by_name("passwd")
pwdtxt.send_keys("pass")



button = driver.find_element_by_id("login-signin")
button.click()
driver.get("https://mail.yahoo.com")
print driver.current_url
但是当我打印当前url时,它总是给我一个登录页面,这意味着它没有登录

你知道怎么修吗? 我正在使用Centos 6和python 2.6,等待它(使用
WebDriverWait
)在成功登录时将您重定向到
yahoo
主页,然后导航到yahoo邮箱:

from selenium.webdriver.support.wait import WebDriverWait

button = driver.find_element_by_id("login-signin")
button.click()

# give it time to log in
wait = WebDriverWait(driver, 10)
wait.until(lambda driver: driver.current_url == "https://www.yahoo.com/")

driver.get("https://mail.yahoo.com")