I am using selenium to scrap web. The web is similar to google map, I need to input a start location and end location and then get the results. The webpage loads slowly and sometimes stops responding. so I try use WebDriverWait to catch a timeout exception and restart the webpage.
However, in fact if the webpage stops responding, the webDriverWait does not throw timeout exception and the code just gets stuck forever. For example, last time, my code stuck at invisibility_of_element_located and does not respond even the timeout is set to 10s.
WebDriverWait(driver,10).until(EC.invisibility_of_element_located((By.XPATH, "//*[@ng-show='route.isCalculating']")))