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
17
votes
3 answers

StaleElementReference Exception in PageFactory

I am trying to learn the PageFactory model. I understood the fact that when we do a initElements, the WebElements are located. Say for example, I click on a webelement and because of which there is a change in one of the other webelements in DOM.…
4
votes
2 answers

StaleElementException when iterating with Python

I'm trying to create a basic web scraper for Amazon results. As I'm iterating through results, I sometimes get to page 5 (sometimes only page 2) of the results and then a StaleElementException is thrown. When I look at the browser after the…
4
votes
4 answers

How to select an option from a dynamic dropdown using Selenium?

I am trying to click on dropdown value to select city in from field in Make my trip http://www.makemytrip.com/. But getting Stale element reference exception. Ids are getting changed on page load. Tried below…
3
votes
2 answers

Python Selenium iterate table of links clicking each link

So this question has been asked before but I am still struggling to get it working. The webpage has a table with links, I want to iterate through clicking each of the links. So this is my code so far from selenium import webdriver from…
3
votes
4 answers

Handle StaleElementReferenceException while using PageFactory

While using Pagefactory I am directly declaring WebElement as below. @AndroidFindBy(accessibility = "androidLocator") @iOSFindBy(accessibility = "iosLocator") private MobileElement element; But, is there a way out to handle StaleElementReference…
3
votes
1 answer

stale element reference: element is not attached to the page document with the chrome web driver

I have already read a lot of threads dealing with this issue in the afternoon but I'm currently running short of solutions unfortunately :( I try to scrape this website: https://www.kumon.co.uk/find-a-tutor/ I use this code in order to store every…
2
votes
1 answer

Why is this code not clicking EVERY element in list?

I am trying to go into every city one by one here but after the program comes back from the first page, it does not go into the next page and displays StaleElementReferenceException error. This is my code: url =…
2
votes
2 answers

StaleElementReferenceException: Message: stale element reference: element is not attached to the page document error when using Selenium and Python

I'm writing a selenium program in python to get links from a website, it runs the first time but when I re-run it, it opens the website in browser properly then it gives an error This is my code: from selenium import webdriver from…
2
votes
1 answer

I want to scrap a website and get all links with title in selenium, but i got stale element issue once i navigated from home page and swtich back

I am doing a selenium project, to scrap all links in a web page and click on it, then get title and description of the news. I want to do this for all links in the home page - say bbc.com but once I click on a link and switch back, the home page got…
2
votes
0 answers

C# -> stale element reference: unable to continue position in forloop when switching pages

I am currently experiencing an issue with an application that I am working on. Tools: Selenium, Visual Studio, C#, PageObjecFactory, PageObjectModel Summary of test: I have an application in which I search by an email address: After the search is…
2
votes
1 answer

Stale Element Reference Exception when moving backwards through browser, even after refresh

I am trying to make a scraper that will go through a bunch of links, export the guide as a PDF, and loop through all the guides that are in the parent folder. It works fine going in, ,but when I try to go backwards, it throws stale exceptions, even…
2
votes
3 answers

How to solve StaleElementReferenceException when looping trough elements (Selenium)

I am trying to web scrape a website to get information about soccer matches. Therefore I'm using the Selenium library in Python. I stored clickable html elements from all the needed matches in a list called "completed_matches". I created a for loop…
2
votes
0 answers

Stale element reference: element is not attached to the page document when trying to getText

i've tried different ways to solve this problem. Here's the current code: private static List getDrillOptionAfter(WebDriver driver, String from) { List menus = getDrillOptionElms(driver, from); List
Success Shrestha
  • 433
  • 1
  • 4
  • 19
2
votes
0 answers

Selenium Unable to catch StaleElementReferenceException

I'm specifically asking what the issues may be with my try/catch block, which isn't described in the issues linked as "duplicates" to this. I'm having an issue where I'm trying to catch a StaleElementReferenceException and then look up the element…
Ben
  • 43
  • 5
2
votes
2 answers

Stale element reference: element is not attached to the page document for Java-Selenium

What I am trying to do is after logging in, driver will click on Property dropdown, select an option and click on submit and repeat the process until the loop is complete. Below is my code: package com.genericlibrary; import…
1
2 3
11 12