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 Ankit,
Yes agreed, I tried putting a wait time of around 2 mins, but dint help out,
In my case here, after a specific text is found & action is performed that specific item is removed from the current page & the count of “listof items” is -1.

could you please suggest on this.

Default Answered on November 25, 2014.

What Exactly are you doing with that List..?

on November 25, 2014.
Add Comment

Your Answer

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