Setting page load timeout in Selenium Python binding

夙愿已清 提交于 2019-12-04 17:37:34
drets

python equivalent code for the question mentioned in the current question (Selenium WebDriver go to page without waiting for page load):

from selenium import webdriver

profile = webdriver.FirefoxProfile()
profile.set_preference('webdriver.load.strategy', 'unstable')
driver = webdriver.Firefox(profile)

and:

driver.set_page_load_timeout(5)
Pykler

There is a ton of questions on this, here is an example. Here is an example that waits until all jquery ajax calls have completed or a 5 second timeout.

from selenium.webdriver.support.ui import WebDriverWait

WebDriverWait(driver, 5).until(lambda s: s.execute_script("return jQuery.active == 0"))

It was a really tedious issue to solve. I just did the following and the problem got resolved:

driver= webdriver.Firefox()
driver.set_page_load_timeout(5)
driver.get('somewebpage')

It worked for me using Firefox driver (and Chrome driver as well).

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!