Closed warpech closed 4 years ago
Also reported in https://github.com/webcomponents/webcomponentsjs/issues/504, since I am not sure if this is WebComponents.js issue or Selenium issue.
Same problem with Selenium IEDriverServer 2.51.1 as well as Selenium Standalone Server 2.52
Selenium Standalone Server shows some stack trace:
c:\www>java -jar selenium-server-standalone-2.52.0.jar
15:40:49.261 INFO - Launching a standalone Selenium Server
15:40:49.308 INFO - Java: Oracle Corporation 25.65-b01
15:40:49.308 INFO - OS: Windows 10 10.0 x86
15:40:49.329 INFO - v2.52.0, with Core v2.52.0. Built from revision 4c2593c
15:40:49.377 INFO - Driver class not found: com.opera.core.systems.OperaDriver
15:40:49.377 INFO - Driver provider com.opera.core.systems.OperaDriver is not re
gistered
15:40:49.377 INFO - Driver provider org.openqa.selenium.safari.SafariDriver regi
stration is skipped:
registration capabilities Capabilities [{browserName=safari, version=, platform=
MAC}] does not match the current platform WIN10
15:40:49.477 INFO - RemoteWebDriver instances should connect to: http://127.0.0.
1:4444/wd/hub
15:40:49.477 INFO - Selenium Server is up and running
15:41:32.314 INFO - Executing: [new session: Capabilities [{nativeEvents=false,
enablePersistentHover=true, browserName=internet explorer, ignoreZoomSetting=tru
e, version=, platform=WINDOWS}]])
15:41:32.324 INFO - Creating a new session for Capabilities [{nativeEvents=false
, enablePersistentHover=true, browserName=internet explorer, ignoreZoomSetting=t
rue, version=, platform=WINDOWS}]
Started InternetExplorerDriver server (64-bit)
2.52.1.0
Listening on port 40366
Only local connections are allowed
15:41:34.655 INFO - Done: [new session: Capabilities [{nativeEvents=false, enabl
ePersistentHover=true, browserName=internet explorer, ignoreZoomSetting=true, ve
rsion=, platform=WINDOWS}]]
15:41:34.708 INFO - Executing: [get: http://warpech.github.io/SeleniumTest/wwwro
ot/webcomponents.html])
15:41:35.148 INFO - Done: [get: http://warpech.github.io/SeleniumTest/wwwroot/we
bcomponents.html]
15:41:35.154 INFO - Executing: [find element: By.xpath: (//h1)[1]])
15:41:45.170 INFO - Executing: [delete session: efc136cc-cc54-4f70-b4d3-5b9f6ee8
5273])
15:42:14.130 ERROR - Unexpected exception during findElement
org.openqa.selenium.remote.UnreachableBrowserException: Error communicating with
the remote browser. It may have died.
Build info: version: '2.52.0', revision: '4c2593c', time: '2016-02-11 19:06:42'
System info: host: 'DESKTOP-ITUP0CI', ip: '10.211.55.4', os.name: 'Windows 10',
os.arch: 'x86', os.version: '10.0', java.version: '1.8.0_65'
Driver info: driver.version: EventFiringWebDriver
Capabilities [{browserAttachTimeout=0, ie.enableFullPageScreenshot=true, enableP
ersistentHover=false, ie.forceCreateProcessApi=false, ie.forceShellWindowsApi=fa
lse, pageLoadStrategy=normal, ignoreZoomSetting=true, ie.fileUploadDialogTimeout
=3000, version=11, platform=WINDOWS, proxy={proxyType=}, nativeEvents=false, ie.
ensureCleanSession=false, elementScrollBehavior=0, ie.browserCommandLineSwitches
=, requireWindowFocus=false, browserName=internet explorer, initialBrowserUrl=ht
tp://localhost:40366/, javascriptEnabled=true, ignoreProtectedModeSettings=false
, enableElementCacheCleanup=true, unexpectedAlertBehaviour=dismiss}]
Session ID: 640b8d62-bb8b-43f9-9eda-30b056fddfad
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.ja
va:665)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDrive
r.java:363)
at org.openqa.selenium.remote.RemoteWebDriver.findElementByXPath(RemoteW
ebDriver.java:500)
at org.openqa.selenium.By$ByXPath.findElement(By.java:361)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDrive
r.java:355)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.openqa.selenium.support.events.EventFiringWebDriver$2.invoke(Even
tFiringWebDriver.java:103)
at com.sun.proxy.$Proxy1.findElement(Unknown Source)
at org.openqa.selenium.support.events.EventFiringWebDriver.findElement(E
ventFiringWebDriver.java:188)
at org.openqa.selenium.remote.server.handler.FindElement.call(FindElemen
t.java:48)
at org.openqa.selenium.remote.server.handler.FindElement.call(FindElemen
t.java:1)
at java.util.concurrent.FutureTask.run(Unknown Source)
at org.openqa.selenium.remote.server.DefaultSession$1.run(DefaultSession
.java:176)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: org.openqa.selenium.WebDriverException: java.net.SocketException: Con
nection reset
Build info: version: '2.52.0', revision: '4c2593c', time: '2016-02-11 19:06:42'
System info: host: 'DESKTOP-ITUP0CI', ip: '10.211.55.4', os.name: 'Windows 10',
os.arch: 'x86', os.version: '10.0', java.version: '1.8.0_65'
Driver info: driver.version: EventFiringWebDriver
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(Driv
erCommandExecutor.java:91)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.ja
va:644)
... 18 more
Caused by: java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(Unknown Source)
at java.net.SocketInputStream.read(Unknown Source)
at org.apache.http.impl.io.SessionInputBufferImpl.streamRead(SessionInpu
tBufferImpl.java:139)
at org.apache.http.impl.io.SessionInputBufferImpl.fillBuffer(SessionInpu
tBufferImpl.java:155)
at org.apache.http.impl.io.SessionInputBufferImpl.readLine(SessionInputB
ufferImpl.java:284)
at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(Default
HttpResponseParser.java:140)
at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(Default
HttpResponseParser.java:57)
at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessagePa
rser.java:261)
at org.apache.http.impl.DefaultBHttpClientConnection.receiveResponseHead
er(DefaultBHttpClientConnection.java:165)
at org.apache.http.impl.conn.CPoolProxy.receiveResponseHeader(CPoolProxy
.java:167)
at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRe
questExecutor.java:272)
at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecu
tor.java:124)
at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.
java:271)
at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java
:184)
at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:88)
at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java
:110)
at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttp
Client.java:184)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttp
Client.java:71)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttp
Client.java:55)
at org.openqa.selenium.remote.internal.ApacheHttpClient.fallBackExecute(
ApacheHttpClient.java:144)
at org.openqa.selenium.remote.internal.ApacheHttpClient.execute(ApacheHt
tpClient.java:90)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExe
cutor.java:142)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(Driv
erCommandExecutor.java:82)
... 19 more
This polyfill overrides basic DOM functionality, and causes JavaScript execution to return a wrapper object instead of the actual DOM node. Since IE doesn't have a native XPath-over-HTML engine, finding elements by XPath is done using a JavaScript XPath execution engine. Additionally, the automation atoms for finding elements are written in JavaScript, and that means finding by CSS selector similarly uses JavaScript, via querySelector()
. As long as this is the case, and the polyfill is returning a wrapped JavaScript object instead of the actual DOM node, findElement()
will not work for the IE driver.
Thank you for a clear response.
I assume that there is no JavaScript bridge that I could use to make Selenium compatible with the polyfill in IE11?
In my very brief look into IE Driver, I saw a mechanism of falling back to Sizzle for element finding. Isn't the WebComponents.js polyfill more or less the same thing?
The Sizzle fall back is vestigial, and almost entirely unused. It will be removed from the project in July. Additionally, it's not entirely an apples-to-apples comparison, since (if memory serves) the Sizzle library returns the actual DOM object, not an object which wraps the DOM object and mimics its properties.
Hi!
I'm facing the exact same problem. @warpech did you found a solution for this problem?
Best,
Unfortunately not.
Expected Behavior
WebDriver should be able to find an element on page.
Actual Behavior
WebDriver can't find an element on page if WebComponents.js is loaded and the browser is IE11. This happens at least for methods
By.XPath
andBy.CssSelector
.The below test project tries Firefox and IE11 driver. Only IE11 fails on this.
My environment is Windows 10 64-bit, using Selenium for .Net.
Versions used: NUnit 2.6.4, NUnitTestAdapter 2.0.0, Selenium.Support 2.52.0, Selenium.WebDriver 2.52.0, WebDriver.IEDriverServer.win64 2.44, WebComponents.js 0.7.21
Steps to reproduce
I have created a test project to recreate the issue: https://github.com/warpech/SeleniumTest
For example, the following test:
Fails with error: