Answers for "how to remove 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

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

Browse Popular Code Answers by Language