The UI application that I am trying to automate has a horizontal menu, with a number of submenu options each (similar to a web browser toolbar).
I am trying to navigate to each sub menu option and verify that the page opens correctly. For IE, Firefox, and Chrome my code works correctly, but I am getting a lot of issues when I try to do it on Edge. The first few sub menu options open correct, but about half way through I am getting the following error:
org.openqa.selenium.StaleElementReferenceException: Stale element
reference (WARNING: The server did not provide any stacktrace
information) Command duration or timeout: 16 milliseconds For
documentation on this error, please visit:
http://seleniumhq.org/exceptions/stale_element_reference.html Build
info: version: '2.53.1', revision: 'a36b8b1', time: '2016-06-30
17:32:46' System info: host: 'LPRDJMDB7R1', ip: '10.254.1.118',
os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0',
java.version: '1.8.0_101' Driver info:
org.openqa.selenium.edge.EdgeDriver Capabilities
[{applicationCacheEnabled=true, acceptSslCerts=true,
browserVersion=38.14393.0.0, platformVersion=10,
locationContextEnabled=true, webStorageEnabled=true,
browserName=MicrosoftEdge, takesScreenshot=true,
pageLoadStrategy=normal, takesElementScreenshot=true,
platformName=windows, platform=ANY}] Session ID:
3C5610CF-77F0-4EBD-ABA0-B09EE4778349
Followed by:
org.openqa.selenium.WebDriverException: Unknown error (WARNING: The
server did not provide any stacktrace information) Command duration or
timeout: 5 milliseconds Build info: version: '2.53.1', revision:
'a36b8b1', time: '2016-06-30 17:32:46' System info: host:
'LPRDJMDB7R1', ip: '10.254.1.118', os.name: 'Windows 10', os.arch:
'amd64', os.version: '10.0', java.version: '1.8.0_101' Driver info:
org.openqa.selenium.edge.EdgeDriver Capabilities
[{applicationCacheEnabled=true, acceptSslCerts=true,
browserVersion=38.14393.0.0, platformVersion=10,
locationContextEnabled=true, webStorageEnabled=true,
browserName=MicrosoftEdge, takesScreenshot=true,
pageLoadStrategy=normal, takesElementScreenshot=true,
platformName=windows, platform=ANY}] Session ID:
3C5610CF-77F0-4EBD-ABA0-B09EE4778349
And then my driver closes.
I've tried a number of different pieces of code to remove the StaleElementReferenceException
(which did work for the other menu items), including:
new WebDriverWait(Setup.driver, 10)
.ignoring(StaleElementReferenceException.class).until(new ExpectedCondition<Boolean>() {
@Override
public Boolean apply(WebDriver driver)
{
WebElement element = TestControl.findElementsByLinkTextScope(subMenuScope, subMenu);
if(element!=null)
{
errorOccurred= TestedElement.click(element);
return true;
}
else
return false;
}
});
Any idea why this might be happening?
I used Selenium 2.53 and Edge WebDriver version 14393.