Trying to find a good way to set a maximum time limit for command execution latency in Selenium Python WebDriver. Ideally, something like:
my_driver = get_my_driver()
my_driver.set_timeout(30) # seconds
my_driver.get('http://www.example.com') # stops / throws exception when time is over 30 seconds
would work. I have found .implicitly_wait(30)
, but I'm not sure if it results in the desired behavior.
In case it is useful, we are specifically using the WebDriver for Firefox.
EDIT
As per @amey's answer, this might be useful:
ff = webdriver.Firefox()
ff.implicitly_wait(10) # seconds
ff.get("http://somedomain/url_that_delays_loading")
myDynamicElement = ff.find_element_by_id("myDynamicElement")
However, it is not clear to me whether the implicit wait applies both to get
(which is the desired functionality) and to find_element_by_id
.
Thanks very much!
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…