from selenium import webdriver from selenium.webdriver.support.ui import WebDriverWait browser = webdriver.Firefox() browser.get("http://testsite.com") element = WebDriverWait(browser, 10).until(lambda browser : browser.find_element_by_id("element")) element.click()
OK, as you can see that even I set the wait time to 0.1 s, but still no timeout exception was thrown. When element.click() is executed, it is not blocked until the whole page loads, and why Just clicked! And I'm expecting timeout error! Just clicked! And I'm expecting timeout error! appeared, and to my surprise new_element = WebDriverWait(browser, 0.1).until(lambda browser : browser.find_element_by_id("element")) wait for the entire page to load. And if you use implicit waits , you will get the same result.
My point is, sometimes when you click on an item, it may even take an hour to load the page due to a bad proxy server, and you obviously DO NOT want , want to wait a long time, what you want is an exception. In this case, how would you work it?
Shane
source share