Skip to content
This repository has been archived by the owner on Nov 29, 2018. It is now read-only.

StaleElementReferenceException : Element not found in the cache #2383

Closed
lukeis opened this issue Mar 3, 2016 · 7 comments
Closed

StaleElementReferenceException : Element not found in the cache #2383

lukeis opened this issue Mar 3, 2016 · 7 comments

Comments

@lukeis
Copy link
Member

lukeis commented Mar 3, 2016

Originally reported on Google Code with ID 2383


What steps will reproduce the problem?
based on the question I posted in google groups http://groups.google.com/group/webdriver/browse_thread/thread/4d77212f4d2ab0a3

for fetching the table columns of each row of a html table, i was using the below code
in a function.

List<WebElement> tableRows = driver.findElements(By.cssSelector("table.grid-table")).get(1).findElements(By.tagName("tr"));


Iterator<WebElement> i = tableRows.iterator(); 
while (i.hasNext()) { 
        WebElement tableRow = i.next(); 
        List<WebElement> tableColumns = 
tableRow.findElements(By.tagName("td")); //throws the exception when the function is
called for 2nd time in a row.
        .. 
        .. 
        }

modifying the same to a fully qualified solves the issue; see below.
List<WebElement> tableRows = driver.findElements(By.cssSelector("table.grid-table")).get(1).findElements(By.tagName("tr"));
Iterator<WebElement> i = tableRows.iterator();
while (i.hasNext()) {
    WebElement tableRow = i.next();
    List<WebElement> tableColumns = driver.findElements(By.cssSelector("table.grid-table")).get(1).findElements(By.tagName("tr")).iterator().next().findElements(By.tagName("td"));




Selenium version: 2.5.0
OS: Mac 10.6.8
Browser: firefox
Brower version: 5.0

i have tested the code for internet explorer and it worked without issues; but firefox
kept giving me the error till i modified the function as described above. I can vouch
that there is no page reload happening that causes the element to be stale in between.


Reported by feby.george on 2011-08-31 19:10:52

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

I have this issue often too when working with Firefox

Reported by pensadov on 2011-09-01 15:31:33

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Reported by barancev on 2011-10-13 08:39:58

  • Labels added: Component-WebDriver

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Does the page contain any frames?
Better yet, if you can provide the page against which the test runs, finding the source
of the problem will be much easier.

Reported by eran.mes on 2011-11-16 14:15:01

  • Status changed: NeedsClarification

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

The same issue is actual for me too

Reported by lykvymolly on 2011-12-03 23:41:32

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

It is actual when test is running on remote machine but RDC is closed(user is still
logged in). If I minimize the RDC session without closing it the tests is pass without
errors. Do you have an idea, what's wrong?

Reported by lykvymolly on 2011-12-03 23:44:38

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Please open a new issue, with a test case, if this is still a problem.

Reported by dawagner on 2012-04-11 21:36:00

  • Status changed: Invalid

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Reported by luke.semerau on 2015-09-17 18:13:38

  • Labels added: Restrict-AddIssueComment-Commit

@lukeis lukeis closed this as completed Mar 3, 2016
@SeleniumHQ SeleniumHQ locked and limited conversation to collaborators Mar 4, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant