Selenium geckodriver无法找到匹配的功能集

时间:2018-02-20 06:31:37

标签: java selenium ubuntu selenium-webdriver geckodriver

我尝试在 Rasberry pi 3中使用 geckodriver 设置selenium webdriver 。当我尝试启动 FirefoxDriver() 的实例时,我收到以下错误:

  

线程中的异常" main"   org.openqa.selenium.SessionNotCreatedException:无法找到   匹配的一组功能构建信息:版本:' 3.9.1',修订版:   ' 63f7b50',时间:' 2018-02-07T22:42:22.379Z'系统信息:主持人:' ****',   ip:' ****',os.name:' Linux',os.arch:' arm',os.version:   ' 4.4.38-v7 +',java.version:' 1.8.0_151'驱动程序信息:driver.version:   FirefoxDriver远程堆栈跟踪:堆栈回溯:0:0x54ba9797 -   backtrace :: backtrace :: trace :: hc4bd56a2f176de7e 1:0x54ba98ff -   backtrace :: capture :: Backtrace :: new :: he3b2a15d39027c46 2:0x54b03e5f    - webdriver :: error :: WebDriverError :: new :: h81babdd86c977032 3:0x54b04c8f -   geckodriver ::木偶:: MarionetteHandler :: create_connection :: hf0532ddb9e159684   4:0x54aed4cb - > :: run :: h2119c674d7b88193 5:0x54acbcbf -   的std :: sys_common ::回溯:: __ rust_begin_short_backtrace :: h21d98a9ff86d4c25   6:0x54ad31cf - std :: panicking :: try :: do_call :: h5cff0c9b18cfdbba 7:   0x54c52237 - panic_unwind :: __ rust_maybe_catch_panic                   at /checkout/src/libpanic_unwind/lib.rs:99 8:0x54ae59e7 - > :: call_box :: h413eb1d9d9f1c473 9:0x54c4c0d3    - alloc :: boxed :: {{impl}} :: call_once<(),()>                   在/checkout/src/liballoc/boxed.rs:692                     - std :: sys_common :: thread :: start_thread                   在/checkout/src/libstd/sys_common/thread.rs:21                     - std :: sys :: imp :: thread :: {{impl}} :: new :: thread_start                   at /checkout/src/libstd/sys/unix/thread.rs:84 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)     在   sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)     在   sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)     at java.lang.reflect.Constructor.newInstance(Constructor.java:423)     在   org.openqa.selenium.remote.W3CHandshakeResponse.lambda $新的$ 0(W3CHandshakeResponse.java:57)     在   org.openqa.selenium.remote.W3CHandshakeResponse.lambda $ getResponseFunction $ 2(W3CHandshakeResponse.java:104)     在   org.openqa.selenium.remote.ProtocolHandshake.lambda $ $了createSession 0(ProtocolHandshake.java:123)     在   java.util.stream.ReferencePipeline $ 3 $ 1.accept(ReferencePipeline.java:193)     在   java.util.Spliterators $ ArraySpliterator.tryAdvance(Spliterators.java:958)     在   java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:126)     在   java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:498)     在   java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:485)     在   java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)     在   java.util.stream.FindOps $ FindOp.evaluateSequential(FindOps.java:152)     在   java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)     在   java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:464)     在   org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:126)     在   org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:73)     在   org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:138)     在   org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)     在   org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:601)     在   org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:219)     在   org.openqa.selenium.remote.RemoteWebDriver。(RemoteWebDriver.java:142)     在   org.openqa.selenium.firefox.FirefoxDriver。(FirefoxDriver.java:120)     在   org.openqa.selenium.firefox.FirefoxDriver。(FirefoxDriver.java:98)     在simplePack.Main.main(Main.java:13)

这是导致错误的简单代码:

WebDriver driver = new FirefoxDriver(); 

你们中有谁知道这个错误的答案吗?

非常感谢您的回答!

最诚挚的问候, 菲利普

1 个答案:

答案 0 :(得分:3)

我也面临同样的问题,我已经通过为gecko驱动程序设置所需的功能来解决它​​。

请遵守以下代码: -

DesiredCapabilities capabilities = DesiredCapabilities.firefox();
        capabilities.setCapability("marionette", true);
        WebDriver driver = new FirefoxDriver(capabilities);

它可能会帮助你。