Reputation: 3818
If element does not exist on the page find_element_by_xpath()
takes too much time hanging the test execution. Is there any way to set timeout to find_element_by_xpath()
function in python?
Upvotes: 2
Views: 1629
Reputation: 3858
You can set an implicit wait using this code -
ff = webdriver.Firefox()
ff.implicitly_wait(10) # seconds
This makes the WebDriver wait for 10 secs before raising an error when you try to find an element on the webpage.
Upvotes: 1