Answers for "stale element exception in selenium python"

1

selenium.common.exceptions.StaleElementReferenceException

from selenium.common.exceptions import NoSuchElementException
from selenium.common.exceptions import StaleElementReferenceException
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions

my_element_id = 'something123'
ignored_exceptions=(NoSuchElementException,StaleElementReferenceException,)
your_element = WebDriverWait(your_driver, some_timeout,ignored_exceptions=ignored_exceptions)
                        .until(expected_conditions.presence_of_element_located((By.ID, my_element_id)))
Posted by: Guest on September-24-2020
0

stale element exception

There are two reasons for Stale element reference:
The element has been deleted entirely.
The element is no longer attached to the DOM.

We face this stale element reference exception when the element we are 
interacting is destroyed and then recreated again. When this happens 
the reference of the element in the DOM becomes stale. So, we are not able to
get the reference to the element.
Posted by: Guest on May-30-2021

Code answers related to "stale element exception in selenium python"

Browse Popular Code Answers by Language