REMitchell / python-scraping

Code samples from the book Web Scraping with Python http://shop.oreilly.com/product/0636920034391.do
4.42k stars 2.48k forks source link

Right code to raise StaleElementReferenceException #51

Open QiliWu opened 7 years ago

QiliWu commented 7 years ago

elem ==driver.find_element_by_tag_name('html') will just return True or False, but will never raise a StaleElementReferenceException. It will raise a StaleElementReferenceException when using elem to do something while it is not the original one due to the page changing.