Questions tagged [staleelementreferenceexception]

StaleElementReferenceException : org.openqa.selenium.StaleElementReferenceException popularly known as StaleElementReferenceException extends org.openqa.selenium.WebDriverException which indicates that a reference to an element is now "stale", which means that the element is no longer attached to the DOM of the page.

StaleElementReferenceException

org.openqa.selenium.StaleElementReferenceException popularly known as StaleElementReferenceException extends org.openqa.selenium.WebDriverException which indicates that a reference to an element is now stale which means that the element is no longer attached to the DOM of the page.

Reference : StaleElementReferenceException

180 questions
2
votes
2 answers

Selenium: How to tell if RemoteWebDriver.findElements(By) can throw StaleElementReferenceException at all?

In my understanding such exception can be thrown only if the code operates on a WebElement instance, calling methods on it after the corresponding DOM element has been reloaded or removed. So in order to find out if RemoteWebDriver.findElements(By)…
2
votes
2 answers

Python/Selenium Stale Element Reference in For Loop

I'm having trouble looping through a list of company ID's and using them in a search bar. My code works just fine when the text file contains just one ID, but when I add a second ID to the list it won't even perform the last click for the first ID,…
2
votes
2 answers

Selenium assertFalse fails with staleelementreferenceexception

I have a selenium test in Java and I am doing some assertions like that: assertFalse(isElementPresent(By.xpath("//td[2]/div"))); private boolean isElementPresent(By by) { try { driver.findElement(by); return true; } catch (NoSuchElementException e)…
2
votes
3 answers

Getting StaleElementReferenceException while trying print the link names

I'm trying to print first 5 pages links displayed in google search.. But getting StateElementReferenceException Not sure which one went wrong.. public class GoogleCoInTest { static WebDriver driver = null; public static void…
1
vote
0 answers

StaleElementReferenceException is not following rules of try and except block

I have tried to scrape whatsapp. i just have to scrape all the names and numbers(also not save people's contact) present in my chat list. Try these in .ipynb file to login to the whatsapp My code : 1) from selenium import webdriver from…
1
vote
1 answer

Issues with Selenium/Python in Scraping Data from Dynamic Table: Staleness Exception with Expected Conditions And Performance Decrease

I'm a beginner and have a lot to learn, so please be patient with me. Using Python and Selenium, I'm trying to scrap table data from a website while navigating through different pages. As I navigate through different pages, the table shows the…
1
vote
1 answer

selenium: stale element reference: element is not attached to the page document

from selenium.webdriver import Chrome from selenium.webdriver.common.by import By from selenium.webdriver.support.wait import WebDriverWait from selenium.webdriver.support import expected_conditions as EC import…
1
vote
1 answer

Why getting this Error selenium.common.exceptions.StaleElementReferenceException:

I know already upload answer to this same question but I try them they are not working for me because there is also some some update in selenium code too. selenium.common.exceptions.StaleElementReferenceException: Message: stale element reference:…
1
vote
1 answer

Selenium 4 (python): stale element reference during table web scraping

I am web scraping a web table that looks like the follow: | A | B | C | D | 1| Name | Surname| Route | href="link with more info"| 2| Name | Surname| Route | href="link with more info"| 3| Name | Surname| Route…
1
vote
1 answer

Can't access input field in POP UP UI selenium. StaleElementReferenceException after element found clickable

I am trying to access an input field in a pop up UI(Aantal KvK uittreksels). Right now I am trying this code: element = wait.until(EC.element_to_be_clickable((By.XPATH,…
1
vote
1 answer

How to click all the fetched links from a search result in selenium using python?

In selenium, I am grabbing some search result URL by XPATH. Now I want to click then one by one which will open then in the same browser one by one where the base URL is opened so that I can switch between then. How can I do that? I am giving my…
1
vote
1 answer

stale element refernce issue and dom refreshing via explicit/implicit waits

I had an issue which I was able to resolve with explicit wait. My curiosity comes, what goes inside selenium webdriver that when I used implicitly wait for 300 seconds, it did continue to give stale element reference, but explicit wait with timeout…
1
vote
1 answer

How to use Selenium in Python to update multiple page elements without refreshing the DOM to avoid StaleElementReferenceException?

I have a school website html page that is used for publishing homework that looks something like this: When you click on each lesson, a javascript div element pops up where you write in the homework and submit via a button. I wanted to automate…
1
vote
1 answer

StaleElementReferenceException clicking a tag

I'm using this selenium code to download a file daily, but sometimes I get stale reference error. How can I be sure to click element as soon as it is avaiable? try: btnMenu = WebDriverWait(driver,…
1
vote
1 answer

Message: stale element reference: element is not attached to the page document while refreshing TABLE DATA

First of all, sorry for my bad english. I have a project to retrieve row data in a table continuously using driver.refresh() The first loop is successful, the data appears for each row. Now for the 2nd loop a message appears Message: stale element…
1
2
3
11 12