简体   繁体   English

硒:连接被拒绝,找不到驱动程序

[英]Selenium: Connection refused and driver not found

I am running a selenium server locally to try to run some tests for Firefox on Linux. 我正在本地运行硒服务器,以尝试在Linux上为Firefox运行一些测试。 I run the server command like this: 我这样运行服务器命令:

java -Dwebdriver.firefox.bin=/usr/bin/firefox -Dwebdriver.firefox.marionette=/home/niru/selenium/geckodriver -jar /home/niru/selenium/selenium-server-standalone-3.5.0.jar

When I run the test command I notice a couple issues : 当我运行测试命令时,我注意到几个问题:
Error: Caused by: org.openqa.selenium.WebDriverException: connection refused 错误: Caused by: org.openqa.selenium.WebDriverException: connection refused以下原因Caused by: org.openqa.selenium.WebDriverException: connection refused
Error: Driver info: driver.version: unknown 错误: Driver info: driver.version: unknown
Issue: Output says Binding default provider to: Org.openqa.selenium.chrome.ChromeDriverService 问题:输出显示将Binding default provider to: Org.openqa.selenium.chrome.ChromeDriverService

Following: https://developer.mozilla.org/en-US/docs/Mozilla/QA/Marionette/WebDriver I verified and made sure that my $PATH variable has /home/niru/selenium/geckodriver . 之后: https : //developer.mozilla.org/en-US/docs/Mozilla/QA/Marionette/WebDriver我验证并确保$ PATH变量具有/home/niru/selenium/geckodriver When running the tests, a Firefox browser window also opens up. 运行测试时,还将打开Firefox浏览器窗口。

Is there a reason why its using chromedriverservice and is unable to find driver version? 为什么使用chromedriverservice并无法找到驱动程序版本?

Exception: 例外:

 [testng] Caused by: org.openqa.selenium.WebDriverException: connection refused
   [testng] Build info: version: '3.5.0', revision: '8def36e068', time: '2017-08-10T23:00:22.093Z'
   [testng] System info: host: '<myhost>', ip: '<ip>', os.name: 'Linux', os.arch: 'amd64', os.version: '3.2.45-0.6.wd.865.49.315.metal1.x86_64', java.version: '1.8.0_112'
   [testng] Driver info: driver.version: unknown
   [testng] remote stacktrace: stack backtrace:
   [testng]    0:           0x4f388c - backtrace::backtrace::trace::h736111741fa0878e
   [testng]    1:           0x4f38c2 - backtrace::capture::Backtrace::new::h63b8a5c0787510c9
   [testng]    2:           0x442d88 - webdriver::error::WebDriverError::new::hea6d4dbf778b2b24
   [testng]    3:           0x449f99 - geckodriver::marionette::MarionetteHandler::create_connection::hf8b6061dba65cdd0
   [testng]    4:           0x42ac91 - <webdriver::server::Dispatcher<T, U>>::run::hba9181b5aacf8f04
   [testng]    5:           0x402c59 - std::sys_common::backtrace::__rust_begin_short_backtrace::h19de262639927233
   [testng]    6:           0x40c065 - std::panicking::try::do_call::h6c1659fc4d01af51
   [testng]    7:           0x5e38ec - panic_unwind::__rust_maybe_catch_panic
   [testng]                         at /checkout/src/libpanic_unwind/lib.rs:98
   [testng]    8:           0x420d32 - <F as alloc::boxed::FnBox<A>>::call_box::h953e5f59694972c5
   [testng]    9:           0x5dc00b - alloc::boxed::{{impl}}::call_once<(),()>
   [testng]                         at /checkout/src/liballoc/boxed.rs:661
   [testng]                          - std::sys_common::thread::start_thread
   [testng]                         at /checkout/src/libstd/sys_common/thread.rs:21
   [testng]                          - std::sys::imp::thread::{{impl}}::new::thread_start
   [testng]                         at /checkout/src/libstd/sys/unix/thread.rs:84
   [testng] Build info: version: '2.53.0', revision: '35ae25b', time: '2016-03-15 17:00:58'
   [testng] System info: host: '<myhost>', ip: '<myip>', os.name: 'Linux', os.arch: 'amd64', os.version: '3.2.45-0.6....x86_64', java.version: '1.8.0_152'
   [testng] Driver info: driver.version: unknown
   [testng]     at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
   [testng]     at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
   [testng]     at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
   [testng]     at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
   [testng]     at org.openqa.selenium.remote.W3CHandshakeResponse.lambda$new$0(W3CHandshakeResponse.java:57)
   [testng]     at org.openqa.selenium.remote.W3CHandshakeResponse.lambda$getResponseFunction$2(W3CHandshakeResponse.java:104)
   [testng]     at org.openqa.selenium.remote.ProtocolHandshake.lambda$createSession$24(ProtocolHandshake.java:360)
   [testng]     at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
   [testng]     at java.util.Spliterators$ArraySpliterator.tryAdvance(Spliterators.java:958)
   [testng]     at java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:126)
   [testng]     at java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:498)
   [testng]     at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:485)
   [testng]     at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
   [testng]     at java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:152)
   [testng]     at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
   [testng]     at java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:464)
   [testng]     at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:363)
   [testng]     at org.openqa.selenium.remote.server.ServicedSession$Factory.apply(ServicedSession.java:159)
   [testng]     at org.openqa.selenium.remote.server.ActiveSessionFactory.lambda$createSession$15(ActiveSessionFactory.java:148)
   [testng]     at java.util.Optional.map(Optional.java:215)
   [testng]     at org.openqa.selenium.remote.server.ActiveSessionFactory.createSession(ActiveSessionFactory.java:148)
   [testng]     at org.openqa.selenium.remote.server.BeginSession.execute(BeginSession.java:69)
   [testng]     at org.openqa.selenium.remote.server.WebDriverServlet.lambda$handle$0(WebDriverServlet.java:231)
   [testng]     at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
   [testng]     at java.util.concurrent.FutureTask.run(FutureTask.java:266)
   [testng]     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
   [testng]     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
   [testng]     at java.lang.Thread.run(Thread.java:745)

Seems is unable to load the geckodriver and try, for default, to load the chromedriver: 似乎无法加载geckodriver,并默认尝试加载chromedriver:

Binding default provider to: Org.openqa.selenium.chrome.ChromeDriverService

You are using selenium-server-standalone-3.5.0.jar , the versions of the geckodriver and of the browser that are you using, are recommended? 您正在使用selenium-server-standalone-3.5.0.jar ,建议使用您使用的geckodriver版本和浏览器版本吗?

Anyway, make sure that the geckodriver is executable: 无论如何,请确保geckodriver是可执行的:

  • chmod +x geckodriver chmod + x壁虎驱动程序

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM