Hi All,
I am running into the following exception
Following is the sequence of actions that i perform
1) I instantiate a WebElement and then perform a mouse Click by
actually simulating a mouseMove and mousePress functions in the
java.awt.Robot class.
2) For the screen coordinates i typecast this WebElement to Locatable
and invoke the etLocationOnScreenOnceScrolledIntoView() function
3) After this the mouse gets moved to the particular location and
clicks on it.
4) This triggers a AJAX request and hence i introduced a sleep for 10
Seconds
5) The CSS of the elements get modified after the Ajax response.
6) Now when i try to call the getText() on the element, it throws the
following exception
Here is the stack trace
*************************************************************************************************
org.openqa.selenium.StaleElementReferenceException: Element is
obsolete
System info:
os.name: 'Linux', os.arch: 'i386', os.version:
'2.6.18-53.1.4.el5PAE', java.version: '1.6.0_11'
Driver info: driver.version: firefox
at org.openqa.selenium.firefox.Response.ifNecessaryThrow
(Response.java:91)
at org.openqa.selenium.firefox.FirefoxDriver.sendMessage
(FirefoxDriver.java:284)
at org.openqa.selenium.firefox.FirefoxWebElement.sendMessage
(FirefoxWebElement.java:277)
at org.openqa.selenium.firefox.FirefoxWebElement.getText
(FirefoxWebElement.java:121)
at apps.webdriver.testWater.TestWaterWD.main(TestWaterWD.java:111)
****************************************************************************************************
Can someone clarify as to when these sort of staleReferenceExceptions
occur. Also any tips on how to avoid them in future
Thanks
Gowtham S