gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-11-29 04:21:28 25 4
gpt4 key购买 nike

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

Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: Unable to find a matching set of capabilities Build info: version: '3.9.1', revision: '63f7b50', time: '2018-02-07T22:42:22.379Z' System info: host: '****', ip: '****', os.name: 'Linux', os.arch: 'arm', os.version: '4.4.38-v7+', java.version: '1.8.0_151' Driver info: driver.version: FirefoxDriver remote stacktrace: stack backtrace: 0: 0x54ba9797 - backtrace::backtrace::trace::hc4bd56a2f176de7e 1: 0x54ba98ff - backtrace::capture::Backtrace::new::he3b2a15d39027c46 2: 0x54b03e5f - webdriver::error::WebDriverError::new::h81babdd86c977032 3: 0x54b04c8f - geckodriver::marionette::MarionetteHandler::create_connection::hf0532ddb9e159684 4: 0x54aed4cb - >::run::h2119c674d7b88193 5: 0x54acbcbf - std::sys_common::backtrace::__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<(),()> at /checkout/src/liballoc/boxed.rs:692 - std::sys_common::thread::start_thread at /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) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at org.openqa.selenium.remote.W3CHandshakeResponse.lambda$new$0(W3CHandshakeResponse.java:57) at org.openqa.selenium.remote.W3CHandshakeResponse.lambda$getResponseFunction$2(W3CHandshakeResponse.java:104) at org.openqa.selenium.remote.ProtocolHandshake.lambda$createSession$0(ProtocolHandshake.java:123) at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193) at java.util.Spliterators$ArraySpliterator.tryAdvance(Spliterators.java:958) at java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:126) at java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:498) at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:485) at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471) at java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:152) at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) at java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:464) at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:126) at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:73) at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:138) at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:601) at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:219) at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:142) at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:120) at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:98) at simplePack.Main.main(Main.java:13)

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

WebDriver driver = new FirefoxDriver(); 

你们有谁知道关于这个故障的答案吗?

非常感谢您的回答!

谨致问候,菲利普

最佳答案

我也遇到了同样的问题,我已经通过为 gecko 驱动程序设置所需的功能解决了这个问题。

请按照代码:-

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

它可能会帮助你。

关于java - Selenium geckodriver 无法找到匹配的功能集,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48879196/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com