RE: how to avoid stale element exception

List<WebElement> listof items= testDriver.findElements(By.cssSelector(“css_path”))

for (WebElement specific_text: listof items)
{}

am arriving @ Stale element exception when:
the specific_text is found & required action is performed
further when the for loop tries to complete the search till
the last count of "listof items"
shubha Default Asked on November 25, 2014 in Selenium WebDriver.

Hi Shubha

Do you mind posting your code here ?

on November 26, 2014.
Add Comment
3 Answers

Hi Shubha

Stale Element Exception can be Avoided by putting Proper wait After the Line That is Causing Javascript Action
Make Sure that Complete Javascript have been Performed Before You TryIng Action on some Element

Regards
Ankit

Vice Professor Answered on November 25, 2014.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.