【发布时间】:2016-06-19 14:57:20
【问题描述】:
我有一个 Python 3.5 脚本,它基本上登录到一个网站(并在登录后被重定向),然后导航到它实际执行工作的另一个页面。如果我在登录后立即运行webdriver.get() 到第二页,它不会导航到目标位置并停留在我登录后它被重定向到的页面上。但是如果我放置一个断点或只是time.sleep(5) -它打开得很好。我在 C# 代码中发现了this 问题,建议在其中添加异步等待。有没有 Pythonic 的方法来解决它?
我的代码供参考:
# underneath is webdriver.Chrome() wrapped up in some exception handling
mydriver = get_web_driver()
# do the first get, wait for the form to load, then fill in the form and call form.submit()
login(mydriver, login_page, "username", "password")
# perform the second get() with the same webdriver
open_invite_page(mydriver, group_invite_page)
【问题讨论】:
标签: python python-3.x selenium selenium-webdriver