用于硒投掷握手错误的MicrosoftWebDriver

时间:2018-03-15 11:33:28

标签: java maven selenium automation microsoft-edge

环境

  • Windows 10 Build:16299.251
  • Microsoft WebDriver版本:16299
  • Selenium版本:3.0.1

我的测试环境适用于最新版本的chrome。一旦我传入Microsoft Edge的驱动程序,我收到以下错误。我使用以下代码连接到驱动程序并启动在chrome上工作正常的驱动程序。如果我尝试升级到最新版本的selenium,我会收到另一个错误,导致我在我的POM中添加Guava作为依赖项,如果这甚至是我发布Edge的问题,Guava也不会让我更新到最新的selenium。

else if (browser.equalsIgnoreCase("edge")) {
                Log.info("matched name");
                if (System.getProperty("os.name").toLowerCase().contains("mac")) {
                    System.setProperty("webdriver.edge.driver", "./src/main/resources/testdriver/MicrosoftWebDriver");
                } else {
                    System.setProperty("webdriver.edge.driver",
                            "./src/main/resources/testdriver/MicrosoftWebDriver.exe");
                }
                localDriver = new EdgeDriver();
                localDriver.manage().window().maximize();
                browserType = "edge";
            }

异常

org.openqa.selenium.SessionNotCreatedException: Unable to create new remote session. desired capabilities = Capabilities [{browserName=MicrosoftEdge, version=, platform=WINDOWS}], required capabilities = Capabilities [{}]
Build info: version: '3.0.1', revision: '1969d75', time: '2016-10-18 09:49:13 -0700'
System info: host: 'IDME-964HWZ1', ip: '10.9.15.19', os.name: 'Windows 10', os.arch: 'x86', os.version: '10.0', java.version: '1.8.0_161'
Driver info: driver.version: EdgeDriver
    at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:91) ~[selenium-remote-driver-3.0.1.jar:?]
    at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:141) ~[selenium-remote-driver-3.0.1.jar:?]
    at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:82) ~[selenium-remote-driver-3.0.1.jar:?]
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:601) ~[selenium-remote-driver-3.0.1.jar:?]
    at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:241) ~[selenium-remote-driver-3.0.1.jar:?]
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:128) ~[selenium-remote-driver-3.0.1.jar:?]
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:141) ~[selenium-remote-driver-3.0.1.jar:?]
    at org.openqa.selenium.edge.EdgeDriver.<init>(EdgeDriver.java:152) ~[selenium-edge-driver-3.0.1.jar:?]
    at org.openqa.selenium.edge.EdgeDriver.<init>(EdgeDriver.java:141) ~[selenium-edge-driver-3.0.1.jar:?]
    at org.openqa.selenium.edge.EdgeDriver.<init>(EdgeDriver.java:98) ~[selenium-edge-driver-3.0.1.jar:?]
    at com.webpacs.utils.LocalBrowserManager.initializeDriver(LocalBrowserManager.java:62) [classes/:?]
    at com.webpacs.utils.DefaultWebDriverSupplier.newWebDriver(DefaultWebDriverSupplier.java:46) [classes/:?]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_161]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_161]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_161]
    at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_161]
    at fitnesse.slim.fixtureInteraction.DefaultInteraction.methodInvoke(DefaultInteraction.java:81) [fitnesse-20151230.jar:?]
    at fitnesse.slim.MethodExecutor.callMethod(MethodExecutor.java:57) [fitnesse-20151230.jar:?]
    at fitnesse.slim.MethodExecutor.invokeMethod(MethodExecutor.java:38) [fitnesse-20151230.jar:?]
    at fitnesse.slim.MethodExecutor.findAndInvoke(MethodExecutor.java:72) [fitnesse-20151230.jar:?]
    at fitnesse.slim.LibraryMethodExecutor.execute(LibraryMethodExecutor.java:18) [fitnesse-20151230.jar:?]
    at fitnesse.slim.StatementExecutor.getMethodExecutionResult(StatementExecutor.java:135) [fitnesse-20151230.jar:?]
    at fitnesse.slim.StatementExecutor.callAndAssign(StatementExecutor.java:118) [fitnesse-20151230.jar:?]
    at fitnesse.slim.instructions.CallAndAssignInstruction.executeInternal(CallAndAssignInstruction.java:38) [fitnesse-20151230.jar:?]
    at fitnesse.slim.instructions.Instruction.execute(Instruction.java:29) [fitnesse-20151230.jar:?]
    at fitnesse.slim.ListExecutor$Executive.executeStatement(ListExecutor.java:49) [fitnesse-20151230.jar:?]
    at fitnesse.slim.ListExecutor$Executive.executeStatements(ListExecutor.java:43) [fitnesse-20151230.jar:?]
    at fitnesse.slim.ListExecutor.execute(ListExecutor.java:85) [fitnesse-20151230.jar:?]
    at fitnesse.slim.SlimServer.executeInstructions(SlimServer.java:84) [fitnesse-20151230.jar:?]
    at fitnesse.slim.SlimServer.processOneSetOfInstructions(SlimServer.java:77) [fitnesse-20151230.jar:?]
    at fitnesse.slim.SlimServer.tryProcessInstructions(SlimServer.java:64) [fitnesse-20151230.jar:?]
    at fitnesse.slim.SlimServer.serve(SlimServer.java:49) [fitnesse-20151230.jar:?]
    at fitnesse.slim.SlimService.handle(SlimService.java:154) [fitnesse-20151230.jar:?]
    at fitnesse.slim.SlimService.acceptOne(SlimService.java:162) [fitnesse-20151230.jar:?]
    at fitnesse.slim.SlimService.accept(SlimService.java:124) [fitnesse-20151230.jar:?]
    at fitnesse.slim.SlimService.startWithFactory(SlimService.java:76) [fitnesse-20151230.jar:?]
    at fitnesse.slim.SlimService.main(SlimService.java:56) [fitnesse-20151230.jar:?]

1 个答案:

答案 0 :(得分:0)

此问题与Google Gauva的版本有关。我在我的POM中有重复的Google Gauva依赖项。版本13之一和版本23之一。删除版本13的依赖项.Selenium版本3.8.x工作正常。 Fluent Wait错误也被删除了。

希望这有助于任何人仔细检查POM文件或依赖文件,以确保您拥有正确版本的Google Gauva。我正在使用谷歌Gauva版本23和selenium 3.8.x在最新版本的chrome上使用适当的硒驱动程序。

如果您在从版本3.0的selenium升级到3.5或更高版本后看到类似的错误,请将您的Google Gauva依赖关系更新为最新的,即selenium使用的库。