Python 使用selenium webdriver登录后打开另一页

Python 使用selenium webdriver登录后打开另一页,python,selenium,selenium-webdriver,Python,Selenium,Selenium Webdriver,我正在使用SeleniumWebDriver使用python在我的网站上打开一个页面 页面链接是:“www.example.com/App/Details.aspx/I=5aM%+8KbCv1o=&T=M30Lr7RtcdR=&H=fRFKse5fKA=” 由于我无法直接打开此页面,我必须首先登录 www.example.com,我是这样做的: from selenium.common.exceptions import TimeoutException from selenium import

我正在使用SeleniumWebDriver使用python在我的网站上打开一个页面

页面链接是:
“www.example.com/App/Details.aspx/I=5aM%+8KbCv1o=&T=M30Lr7RtcdR=&H=fRFKse5fKA=”

由于我无法直接打开此页面,我必须首先登录 www.example.com,我是这样做的:

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

driver = webdriver.Firefox()
try:
    driver.set_page_load_timeout(10)
    driver.get('http://www.example.com')   
except Exception:
    print ('time out')
    #driver.find_element_by_id("Default").send_keys(Keys.CONTROL +'Escape')

username = driver.find_element_by_id("usrid")
password = driver.find_element_by_id("pswd")


username.send_keys("Sample_user")
password.send_keys("samplepass")

driver.find_element_by_id("submitbtn").click()
在此之后,我可以成功登录, 但是当我使用

driver.get("www.example.com/App/Details.aspx/I=5aM%+8KbCv1o=&T=M30Lr7RtcdR=&H=fRFKse5fKA==") 
我在说“请先登录”时出错。请为同样的问题提出解决方案。

您通过

password.send_keys 
但在此之后,您还需要使用

password.send_keys((Keys.ENTER)
在这之后,你必须有一个

sleep(1) 

在打开下一页之前

为什么不尝试自动执行手动步骤,而不是直接调用预编译的
url
WebDriverWait Until(expect...