s.find_element_by_xpath("//*[@id='container']/div/div[1]/div[1]/div[2]/div[2]/form/div/div/input").send_keys("car")
The above code works fine
but
cars=s.find_element_by_xpath("//*[@id='container']/div/div[1]/div[1]/div[2]/div[2]/form/div/div/input")
cars.send_keys("car")
This one throws error raise exception_class(message, screen, stacktrace) selenium.common.exceptions.StaleElementReferenceException: Message: stale element reference: element is not attached to the page document
So variable assignment and calling functions with variables is not a good way?
Aucun commentaire:
Enregistrer un commentaire