在Windows 10 VM上使用Microsoft Edge Web浏览器启动新的remoteWebDriver会话时,Selenium挂起

时间:2016-04-21 20:09:37

标签: selenium selenium-webdriver microsoft-edge

在Windows 10 VM上启动Microsoft Edge的远程Web驱动程序会话时出现错误。 我们有一个配置有多个节点的selenium网格,这些节点具有各种OS /浏览器组合。除了我们的新Windows 10节点之外的所有节点都按预期工作。我们已使用Microsoft Edge浏览器version=21.10586.0.0配置了Windows 10 VM,并在VM上添加了MicrosoftWebDriver。 VM上Web驱动程序的路径使用系统属性 -

进行设置
-Dwebdriver.edge.driver="C:\Selenium\MicrosoftWebDriver.exe"

在我的selenium测试中,我实例化了配置为Windows 10 VM上MicrosoftWebDriver的selenium web驱动程序。在初始化期间,我设置了远程驱动程序的功能,并且我有设置的日志输出:

08:57:32.932 INFO - Executing: [new session: Capabilities [{platform=WINDOWS, javascriptEnabled=true, browserName=MicrosoftEdge, applicationName=Win10_EDGE, version=21.10586.0.0}]])
08:57:32.948 INFO - Creating a new session for Capabilities [{platform=WINDOWS, javascriptEnabled=true, browserName=MicrosoftEdge, applicationName=Win10_EDGE, version=21.10586.0.0}]

建立远程连接,在VM上打开Edge浏览器并且可以运行。此时代码挂起在selenium代码中创建远程驱动程序 - selenium-remote-driver-2.53.0.jar

最终它超时错误:

java.util.concurrent.ExecutionException: org.openqa.selenium.WebDriverException: java.lang.reflect.InvocationTargetException
Build info: version: '2.53.0', revision: '35ae25b', time: '2016-03-15 17:00:58'
System info: host: 'xxxx', ip: 'xxx.xx.xxx.xxx', os.name: 'Windows 8', os.arch: 'x86', os.version: '6.2', java.version: '1.7.0_51'
Driver info: driver.version: unknown
        at java.util.concurrent.FutureTask.report(Unknown Source)
        at java.util.concurrent.FutureTask.get(Unknown Source)
        at org.openqa.selenium.remote.server.DefaultSession.execute(DefaultSession.java:183)
        at org.openqa.selenium.remote.server.DefaultSession.<init>(DefaultSession.java:119)
        at org.openqa.selenium.remote.server.DefaultSession.createSession(DefaultSession.java:95)
        at org.openqa.selenium.remote.server.DefaultDriverSessions.newSession(DefaultDriverSessions.java:124)
        at org.openqa.selenium.remote.server.handler.NewSession.handle(NewSession.java:59)
        at org.openqa.selenium.remote.server.handler.NewSession.handle(NewSession.java:1)
        at org.openqa.selenium.remote.server.rest.ResultConfig.handle(ResultConfig.java:111)
        at org.openqa.selenium.remote.server.JsonHttpCommandHandler.handleRequest(JsonHttpCommandHandler.java:79)
        at org.openqa.selenium.remote.server.DriverServlet.handleRequest(DriverServlet.java:204)
        at org.openqa.selenium.remote.server.DriverServlet.doPost(DriverServlet.java:166)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
        at org.openqa.selenium.remote.server.DriverServlet.service(DriverServlet.java:132)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
        at org.openqa.jetty.jetty.servlet.ServletHolder.handle(ServletHolder.java:428)
        at org.openqa.jetty.jetty.servlet.ServletHandler.dispatch(ServletHandler.java:680)
        at org.openqa.jetty.jetty.servlet.ServletHandler.handle(ServletHandler.java:571)
        at org.openqa.jetty.http.HttpContext.handle(HttpContext.java:1526)
        at org.openqa.jetty.http.HttpContext.handle(HttpContext.java:1479)
        at org.openqa.jetty.http.HttpServer.service(HttpServer.java:920)
        at org.openqa.jetty.http.HttpConnection.service(HttpConnection.java:820)
        at org.openqa.jetty.http.HttpConnection.handleNext(HttpConnection.java:986)
        at org.openqa.jetty.http.HttpConnection.handle(HttpConnection.java:837)
        at org.openqa.jetty.http.SocketListener.handleConnection(SocketListener.java:243)
        at org.openqa.jetty.util.ThreadedServer.handle(ThreadedServer.java:358)
        at org.openqa.jetty.util.ThreadPool$PoolThread.run(ThreadPool.java:537)
Caused by: org.openqa.selenium.WebDriverException: java.lang.reflect.InvocationTargetException
Build info: version: '2.53.0', revision: '35ae25b', time: '2016-03-15 17:00:58'
System info: host: 'xxxx', ip: 'xxx.xx.xxx.xxx', os.name: 'Windows 8', os.arch: 'x86', os.version: '6.2', java.version: '1.7.0_51'
Driver info: driver.version: unknown
        at org.openqa.selenium.remote.server.DefaultDriverProvider.callConstructor(DefaultDriverProvider.java:113)
        at org.openqa.selenium.remote.server.DefaultDriverProvider.newInstance(DefaultDriverProvider.java:97)
        at org.openqa.selenium.remote.server.DefaultDriverFactory.newInstance(DefaultDriverFactory.java:60)
        at org.openqa.selenium.remote.server.DefaultSession$BrowserCreator.call(DefaultSession.java:222)
        at org.openqa.selenium.remote.server.DefaultSession$BrowserCreator.call(DefaultSession.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: java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
        at java.lang.reflect.Constructor.newInstance(Unknown Source)
        at org.openqa.selenium.remote.server.DefaultDriverProvider.callConstructor(DefaultDriverProvider.java:103)
        ... 9 more
Caused by: org.openqa.selenium.TimeoutException: Timeout (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 917.04 seconds
Build info: version: '2.53.0', revision: '35ae25b', time: '2016-03-15 17:00:58'
System info: host: 'xxxx', ip: 'xxx.xx.xxx.xxx', os.name: 'Windows 8', os.arch: 'x86', os.version: '6.2', java.version: '1.7.0_51'
Driver info: org.openqa.selenium.edge.EdgeDriver
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
        at java.lang.reflect.Constructor.newInstance(Unknown Source)
        at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:206)
        at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:158)
        at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:678)
        at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:249)
        at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:131)
        at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:144)
        at org.openqa.selenium.edge.EdgeDriver.<init>(EdgeDriver.java:152)
        at org.openqa.selenium.edge.EdgeDriver.<init>(EdgeDriver.java:120)
        ... 14 more
13:28:49.532 WARN - Exception: Timeout (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 917.04 seconds

我正在使用: 硒的服务器独立-2.53.0.jar, Microsoft WebDriver 2015年秋季从Microsoft站点更新

我注意到上面的系统信息列出了Windows 8 - 即使安装了Windows 10。

有没有其他人看过这个问题或者知道出了什么问题?

1 个答案:

答案 0 :(得分:0)

在我成功但痛苦地将Edge设置为Selenium网格的一部分的过程中,我得到了非常相似的异常。这里至少有两个可能的问题:

  1. selenium-standalone-server是在后台启动的(例如使用Task-Scheduler)还是前台? (例如手动或作为启动程序) 边缘驱动程序必须在前台运行,以便其窗口可以实际显示在桌面上。因此,节点无法在启动时作为Windows服务启动,也不能从Windows任务计划程序启动。自动启动节点的最佳方法是配置自动登录并添加批处理脚本,将节点启动到用户的启动程序,如my article中所述。

  2. 是否在与Edge相同的节点中启用了其他浏览器?这已知会引起问题。建议在同一台机器上启动2个独立的节点(当然在不同的端口上):一个仅用于Edge,第二个用于IE,FF和Chrome。有关详细信息,请参阅this answer