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
0
votes
1 answer

Selenium function to check for freshness before click to avoid stale element exception

I'm working on scraping data from a site which uses jquery and sometimes I get the Stale Element exception which I have fixed by introducing sleep between a try/except. However, I wanted make it more robust and when going through the docs:…
0
votes
0 answers

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

I am facing problem error below: stale element reference: element is not attached to the page document I have to click value in table form to select the data and process to following steps. These are my codes, and error line is the last one. from…
0
votes
1 answer

Python Selenium execute_script("return window.dataLayer") returns stale reference? What's stale? It's all still there

I can watch execute_script() run many many times in the AngularJS routed single page I'm testing since it seems a lot of the code uses execute_script() to talk to the browser. The specific call is: driver.execute_script("return…
0
votes
3 answers

StaleElementReferenceException in second and further test of group

I have specflow test with many examples, so if I run tests separately all pass. But when I run them as a group only first pass well, other fails with OpenQA.Selenium.StaleElementReferenceException : stale element reference: element is not attached…
Andy Ye
  • 1
  • 2
0
votes
2 answers

StaleElementReferenceException when iterating through dynamical iterable

I want to scroll down the website by looping through all webElements and I'm doing it in this way: driver.get('https://justjoin.it/') driver.maximize_window() while True: for web_element in driver.find_elements_by_class_name('css-1x9zltl'): …
0
votes
0 answers

What is the best way to find all broken links on a website with Selenium and Java without getting a StaleElementReferenceException?

I'm trying to find all broken links on a webpage with Selenium for Java. I tried it with a simple tutorial and it seems to work on very basic websites but in my case, the DOM seems to change and I often get a StaleElementReferenceException. I'm not…
cepi1993
  • 35
  • 5
0
votes
1 answer

How to find a list of rows from grid using selenium

I have a scenario in my framework to get the row count and select one or multiple rows from the grid. Here, the class name and attributes are the same for all rows, the id is kept on changing for each row. I've written this xpath to get header…
Marks
  • 1
  • 1
0
votes
2 answers

StaleElementReferenceException: element is not attached to the page document while selecting the options from multiple Dropdowns using Selenium Python

Code trial: #coding=utf-8 from selenium import webdriver from selenium.webdriver.common.keys import Keys from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import Select, WebDriverWait from selenium.webdriver.support…
0
votes
1 answer

Python & Selenium: Iterate through list of WebElements Error: StaleElementReferenceException

Good afternoon, Somewhat new to Python and webscraping, so any help would be greatly appreciated! First: The Code from selenium import webdriver import time chrome_path = r"/Users/ENTER/Desktop/chromedriver" driver =…
0
votes
1 answer

Selenium Python - Why StaleElementReferenceException and not NoSuchElement and how to catch

I'm working on a piece of code to automate a login process. The process consists of filling in a username on the first page, clicking a button and proceeding to a second page where I'll fill in pw and press on a second button. The webpage sees a lot…
0
votes
0 answers

Selenium Handle Stale Element in a for loop

I have an UI like this: I have to choose each attachment and click to download or delete. To download: // get the list of radio buttons List attachments = driver().findElements(By.className("select-attachment")); for (WebElement…
0
votes
1 answer

Selenium iterate over elements and click on the element if it meets certain condition

I am trying to create a web scraper and I ran into problem. I am trying to iterate over elements on the left side of the widget and if name starts with 'a', I want to click on minus sign and move it to the right side. I managed to find all the…
0
votes
1 answer

Selenium shows stale error when i try to click all link using for loop?

all_divs contain all the links i got . I need to click all of them but when i try to do , selenum throws stale error saying "selenium.common.exceptions.StaleElementReferenceException: Message: The element reference of is stale; either the…
0
votes
1 answer

How to handle stale element reference: element is not attached to the page document

I have an application where I have to wait for a button to be visible on the page and click on it. The button is the one that has id="next-arrow-button", but on the parent div it has id="recorder-0" After pressing on this button, the button won't…
0
votes
1 answer

Getting "StaleElementReferenceException" when accessing options in drop down menu

In Python and Selenium, I'm populating a form, submitting it, then scraping the resulting multi-page table that appears on the page underneath the form. After I scrape every page of this table, I reset the form and attempt to repopulate the form.…