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

IEDriver: Error determining if element is displayed #7524

Open
@lukeis

Description

@lukeis

Originally reported on Google Code with ID 7524

I have webdriver code like this:

wait.until(ExpectedConditions.invisibilityOfElementLocated(By.id("ElementToDisappear")));

I sometimes (1 out of 10 times) get an "unknown" error from the call to isDisplayed(..)
inside the invisiblity check 
(line 459 of ExpectedConditions.java)

Here's a sample stack trace:

org.openqa.selenium.WebDriverException: Error determining if element is displayed (WARNING:
The server did not provide any stacktrace information) Command duration or timeout:
285 milliseconds Build info: version: '2.41.0', revision: '3192d8a', time: '2014-03-27
17:17:32' System info: host: 'IE9Win7', ip: '192.168.13.196', os.name: 'Windows 7',
os.arch: 'x86', os.version: '6.1', java.version: '1.7.0_55' Session ID: 99247e66-e0a1-4074-a09e-fc64324d0c5f
Driver info: org.openqa.selenium.ie.InternetExplorerDriver Capabilities [{platform=WINDOWS,
javascriptEnabled=true, elementScrollBehavior=0, ignoreZoomSetting=false, enablePersistentHover=true,
ie.ensureCleanSession=false, browserName=internet explorer, enableElementCacheCleanup=true,
unexpectedAlertBehaviour=dismiss, version=9, ie.usePerProcessProxy=false, cssSelectorsEnabled=true,
ignoreProtectedModeSettings=false, requireWindowFocus=false, handlesAlerts=true, initialBrowserUrl=http://localhost:7179/,
ie.forceCreateProcessApi=false, nativeEvents=true, browserAttachTimeout=0, ie.browserCommandLineSwitches=,
takesScreenshot=true}] Command duration or timeout: 482 milliseconds Build info: version:
'2.41.0', revision: '3192d8a6c4449dc285928ba024779344f5423c58', time: '2014-03-27 11:29:39'
System info: host: 'softrek-ci01.softrekdom1.local', ip: '192.168.1.24', os.name: 'Linux',
os.arch: 'amd64', os.version: '2.6.32-358.el6.x86_64', java.version: '1.7.0_25' Session
ID: f15a6a4a-6645-4d72-897b-1aa7354ae0e6 Driver info: org.openqa.selenium.remote.RemoteWebDriver
Capabilities [{platform=WINDOWS, javascriptEnabled=true, elementScrollBehavior=0, ignoreZoomSetting=false,
enablePersistentHover=true, ie.ensureCleanSession=false, browserName=internet explorer,
enableElementCacheCleanup=true, unexpectedAlertBehaviour=dismiss, webdriver.remote.sessionid=f15a6a4a-6645-4d72-897b-1aa7354ae0e6,
version=9, ie.usePerProcessProxy=false, cssSelectorsEnabled=true, ignoreProtectedModeSettings=false,
requireWindowFocus=false, handlesAlerts=true, initialBrowserUrl=http://localhost:7179/,
ie.forceCreateProcessApi=false, nativeEvents=true, browserAttachTimeout=0, ie.browserCommandLineSwitches=,
takesScreenshot=true}]
org.openqa.selenium.WebDriverException: Error determining if element is displayed (WARNING:
The server did not provide any stacktrace information)
Command duration or timeout: 285 milliseconds
Build info: version: '2.41.0', revision: '3192d8a', time: '2014-03-27 17:17:32'
System info: host: 'IE9Win7', ip: '192.168.13.196', os.name: 'Windows 7', os.arch:
'x86', os.version: '6.1', java.version: '1.7.0_55'
Session ID: 99247e66-e0a1-4074-a09e-fc64324d0c5f
Driver info: org.openqa.selenium.ie.InternetExplorerDriver
Capabilities [{platform=WINDOWS, javascriptEnabled=true, elementScrollBehavior=0, ignoreZoomSetting=false,
enablePersistentHover=true, ie.ensureCleanSession=false, browserName=internet explorer,
enableElementCacheCleanup=true, unexpectedAlertBehaviour=dismiss, version=9, ie.usePerProcessProxy=false,
cssSelectorsEnabled=true, ignoreProtectedModeSettings=false, requireWindowFocus=false,
handlesAlerts=true, initialBrowserUrl=http://localhost:7179/, ie.forceCreateProcessApi=false,
nativeEvents=true, browserAttachTimeout=0, ie.browserCommandLineSwitches=, takesScreenshot=true}]
Command duration or timeout: 482 milliseconds
Build info: version: '2.41.0', revision: '3192d8a6c4449dc285928ba024779344f5423c58',
time: '2014-03-27 11:29:39'
System info: host: 'softrek-ci01.softrekdom1.local', ip: '192.168.1.24', os.name: 'Linux',
os.arch: 'amd64', os.version: '2.6.32-358.el6.x86_64', java.version: '1.7.0_25'
Session ID: f15a6a4a-6645-4d72-897b-1aa7354ae0e6
Driver info: org.openqa.selenium.remote.RemoteWebDriver
Capabilities [{platform=WINDOWS, javascriptEnabled=true, elementScrollBehavior=0, ignoreZoomSetting=false,
enablePersistentHover=true, ie.ensureCleanSession=false, browserName=internet explorer,
enableElementCacheCleanup=true, unexpectedAlertBehaviour=dismiss, webdriver.remote.sessionid=f15a6a4a-6645-4d72-897b-1aa7354ae0e6,
version=9, ie.usePerProcessProxy=false, cssSelectorsEnabled=true, ignoreProtectedModeSettings=false,
requireWindowFocus=false, handlesAlerts=true, initialBrowserUrl=http://localhost:7179/,
ie.forceCreateProcessApi=false, nativeEvents=true, browserAttachTimeout=0, ie.browserCommandLineSwitches=,
takesScreenshot=true}]
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
    at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:193)
    at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:145)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:595)
    at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:268)
    at org.openqa.selenium.remote.RemoteWebElement.isDisplayed(RemoteWebElement.java:320)
    at org.openqa.selenium.support.ui.ExpectedConditions$15.apply(ExpectedConditions.java:459)
    at org.openqa.selenium.support.ui.ExpectedConditions$15.apply(ExpectedConditions.java:455)
    at org.openqa.selenium.support.ui.FluentWait.until(FluentWait.java:208)
    at com.softrek.test.functional.dashboard.panel.Panel.waitForLoad(Panel.java:30)


I poked around in the IEDriver code and found that this error is coming from line 58
in cpp/iedriver/CommandHandlers/IsElementDisplayedCommandHandler.h
I think it's caused by the element in question being removed from the dom exactly at
the moment between GetElement and IsDisplayed; I would expect a stale element error
to be thrown instead of an unknown error.

I forked and made what I think would be a suitable improvement to better identify a
stale or not found element  when situations like this happen.

See https://github.com/amuraco/selenium/commit/7a8c291b0b24f473be6c9290a0225e6c1c4b1eba
I do not have the necessary toolchain to be able to recompile and test this, but hopefully
that commit is illustrative for the explaining what could be improved.

Reported by [email protected] on 2014-06-19 18:05:52

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions