WebDriverException:java.lang.reflect.InvocationTargetException - Selenium RemoteWebDriver

时间:2015-08-12 19:37:26

标签: selenium selenium-webdriver webdriver invocationtargetexception remotewebdriver

我使用Selenium来运行具有Web视图的桌面应用程序。两天前,我的过程运行得很好,我的测试正在运行,但我必须做一些我的手动测试,更改了我的计算机上的文件或更改了我需要的文件Selenium,因为现在我可以启动我的应用程序,请参阅Web视图,但应用程序在我的测试可以与之交互之前关闭。

我运行selenium独立服务器,每次进程失败时都会看到以下堆栈跟踪:

C:\Git\MyDesktopApp.AutomatedTests\bin\Debug>REM @Echo off

C:\Git\MyDesktopApp.AutomatedTests\bin\Debug>REM Use "REM" (wh
ich is a batch file comment) to Toggle between the commands below to change to a
 different location (version) of MyDesktopApp.

C:\Git\MyDesktopApp.AutomatedTests\bin\Debug>REM MAKE SURE THA
T YOU HAVE DOWNLOADED VERSION *2.47.1* OF THE SELENIUM SERVER STANDALONE JAR FIL
E AND PLACED IT IN THE FOLLOWING PATH: REPOSITORYFOLDER\MyDesktopAppAutomatedTests\bin\Debug

C:\Git\MyDesktopApp.AutomatedTests\bin\Debug>java.exe -jar .\s
elenium-server-standalone-2.47.1.jar -Dwebdriver.chrome.driver="C:\Program Files
 (x86)\MyDesktopApp-debug\MyDesktopApp.exe"
13:12:17.106 INFO - Launching a standalone Selenium Server
Setting system property webdriver.chrome.driver to C:\Program Files (x86)\MyDesktopApp.exe
13:12:17.215 INFO - Java: Oracle Corporation 25.51-b03
13:12:17.215 INFO - OS: Windows 7 6.1 amd64
13:12:17.221 INFO - v2.47.1, with Core v2.47.1. Built from revision 411b314
13:12:17.256 INFO - Driver class not found: com.opera.core.systems.OperaDriver
13:12:17.256 INFO - Driver provider com.opera.core.systems.OperaDriver is not re
gistered
13:12:17.410 INFO - RemoteWebDriver instances should connect to: http://127.0.0.
1:4444/wd/hub
13:12:17.411 INFO - Selenium Server is up and running
13:12:17.979 INFO - Executing: [new session: Capabilities [{browserName=chrome,
javascriptEnabled=true, version=, platform=ANY}]])
13:12:17.986 INFO - Creating a new session for Capabilities [{browserName=chrome
, javascriptEnabled=true, version=, platform=ANY}]
13:12:38.871 WARN - Exception thrown
java.util.concurrent.ExecutionException: org.openqa.selenium.WebDriverException:
 java.lang.reflect.InvocationTargetException
Build info: version: '2.47.1', revision: '411b314', time: '2015-07-30 03:03:16'
System info: host: 'w7-alitwick', ip: '10.21.0.19', os.name: 'Windows 7', os.arc
h: 'amd64', os.version: '6.1', java.version: '1.8.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(DefaultSessi
on.java:183)
        at org.openqa.selenium.remote.server.DefaultSession.<init>(DefaultSessio
n.java:119)
        at org.openqa.selenium.remote.server.DefaultSession.createSession(Defaul
tSession.java:95)
        at org.openqa.selenium.remote.server.DefaultDriverSessions.newSession(De
faultDriverSessions.java:125)
        at org.openqa.selenium.remote.server.handler.NewSession.handle(NewSessio
n.java:58)
        at org.openqa.selenium.remote.server.handler.NewSession.handle(NewSessio
n.java:1)
        at org.openqa.selenium.remote.server.rest.ResultConfig.handle(ResultConf
ig.java:111)
        at org.openqa.selenium.remote.server.JsonHttpCommandHandler.handleReques
t(JsonHttpCommandHandler.java:175)
        at org.openqa.selenium.remote.server.DriverServlet.handleRequest(DriverS
ervlet.java:202)
        at org.openqa.selenium.remote.server.DriverServlet.doPost(DriverServlet.
java:164)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
        at org.openqa.selenium.remote.server.DriverServlet.service(DriverServlet
.java:130)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
        at org.openqa.jetty.jetty.servlet.ServletHolder.handle(ServletHolder.jav
a:428)
        at org.openqa.jetty.jetty.servlet.ServletHandler.dispatch(ServletHandler
.java:680)
        at org.openqa.jetty.jetty.servlet.ServletHandler.handle(ServletHandler.j
ava: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:9
86)
        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.InvocationT
argetException
Build info: version: '2.47.1', revision: '411b314', time: '2015-07-30 03:03:16'
System info: host: 'w7-alitwick', ip: '10.21.0.19', os.name: 'Windows 7', os.arc
h: 'amd64', os.version: '6.1', java.version: '1.8.0_51'
Driver info: driver.version: unknown
        at org.openqa.selenium.remote.server.DefaultDriverProvider.callConstruct
or(DefaultDriverProvider.java:113)
        at org.openqa.selenium.remote.server.DefaultDriverProvider.newInstance(D
efaultDriverProvider.java:97)
        at org.openqa.selenium.remote.server.DefaultDriverFactory.newInstance(De
faultDriverFactory.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 Sou
rce)
        at java.lang.reflect.Constructor.newInstance(Unknown Source)
        at org.openqa.selenium.remote.server.DefaultDriverProvider.callConstruct
or(DefaultDriverProvider.java:103)
        ... 9 more
Caused by: org.openqa.selenium.remote.UnreachableBrowserException: Could not sta
rt a new session. Possible causes are invalid address of the remote server or br
owser start-up failure.
Build info: version: '2.47.1', revision: '411b314', time: '2015-07-30 03:03:16'
System info: host: 'w7-alitwick', ip: '10.21.0.19', os.name: 'Windows 7', os.arc
h: 'amd64', os.version: '6.1', java.version: '1.8.0_51'
Driver info: driver.version: ChromeDriver
        at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.ja
va:589)
        at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriv
er.java:242)
        at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.jav
a:128)
        at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.jav
a:141)
        at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:170)

        at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:138)

        ... 14 more
Caused by: java.lang.IllegalStateException: The process has not exited yet there
fore no result is available ...
        at org.apache.commons.exec.DefaultExecuteResultHandler.getException(Defa
ultExecuteResultHandler.java:76)
        at org.openqa.selenium.os.UnixProcess.checkForError(UnixProcess.java:171
)
        at org.openqa.selenium.os.CommandLine.checkForError(CommandLine.java:183
)
        at org.openqa.selenium.remote.service.DriverService.start(DriverService.
java:169)
        at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(Driv
erCommandExecutor.java:63)
        at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.ja
va:568)
        ... 19 more
13:12:38.878 WARN - Exception: The process has not exited yet therefore no resul
t is available ...

我试过了: - 通过NuGet更新我的selenium文件 - 更新我的ChromeDriver - 已验证Chrome正在运行 - 更新我的服务器.jar文件 - 重新安装Java - 已验证我的RemoteWebDriver指向http://127.0.0.1:4444 - 验证我的.bat文件包含selenium独立服务器的正确版本(2.47.1)

然而,这不起作用。 我的猜测是,我的.jar文件依赖项可能搞砸了,但如果是这种情况,我也不知道如何修复它们。

任何帮助都会非常感激!

0 个答案:

没有答案