'UnknownError',消息:'处理命令时发生未知的服务器端错误。',orgStatusMessage:'webdriver.io拒绝连接

时间:2018-09-29 19:16:36

标签: selenium selenium-webdriver webdriver webdriver-io

我正在遵循本指南:http://webdriver.io/guide.html和Firefox版本,我正在使用62.0

我遵循以下步骤:

  1. 我下载了最新的硒独立服务器版本3.14。
  2. 我已经下载了最新的gecko驱动程序版本0.22.0,并将其提取到项目文件夹中
  3. 使用命令java -jar -Dwebdriver.gecko.driver =。/ geckodriver selenium-server-standalone-3.5.3.jar

  4. 运行Selenium独立版本
  5. 然后运行命令npm install webdriverio

  6. 使用代码创建测试文件test.js
var webdriverio = require('webdriverio');
var options = {
    desiredCapabilities: {
        browserName: 'firefox'
    }
};

webdriverio
    .remote(options)
    .init()
    .url('http://www.google.com')
    .getTitle().then(function(title) {
        console.log('Title was: ' + title);
    })
    .end()
    .catch(function(err) {
        console.log(err);
    });
  1. 节点test.js

而不是输出“标题为:Google” 我收到错误

{ Error: An unknown server-side error occurred while processing the command.
    at end() - test.js:15:6
  details: undefined,
  message: 'connection refused\nBuild info: version: \'3.4.0\', revision: \'unknown\', time: \'unknown\'\nSystem info: host: \'RITESHs-MacBook-Pro.local\', ip: \'192.168.1.2\', os.name: \'Mac OS X\', os.arch: \'x86_64\', os.version: \'10.13.6\', java.version: \'1.8.0_171\'\nDriver info: driver.version: FirefoxDriver\nremote stacktrace: stack backtrace:\n   0:        0x10b43d49e - backtrace::backtrace::trace::h3ab5720c483fe461\n   1:        0x10b43d4dc - backtrace::capture::Backtrace::new::h096accf58447e0d5\n   2:        0x10b376534 - webdriver::error::WebDriverError::new::hc0958d01acda7bfc\n   3:        0x10b37d300 - geckodriver::marionette::MarionetteHandler::create_connection::h59a68c8dfef48e54\n   4:        0x10b35cd3c - _$LT$webdriver..server..Dispatcher$LT$T$C$$u20$U$GT$$GT$::run::h5a26ba0bb4fdb139\n   5:        0x10b3350c5 - std::sys_common::backtrace::__rust_begin_short_backtrace::h3f868f7a1a12bdcc\n   6:        0x10b33fd2d - std::panicking::try::do_call::hfce1ad2a948c3632\n   7:        0x10b4e9a5c - __rust_maybe_catch_panic\n   8:      0x10b352eb5 - _$LT$F$u20$as$u20$alloc..boxed..FnBox$LT$A$GT$$GT$::call_box::h651dedb755194a8c\n   9:        0x10b4e5c4b - std::sys::imp::thread::Thread::new::thread_start::h48c72bb09587cbc3\n  10:     0x7fff515f0660 - _pthread_body\n  11:     0x7fff515f050c- _pthread_start',
  type: 'RuntimeError',
  seleniumStack:
   { type: 'UnknownError',
     message: 'An unknown server-side error occurred while processing the command.',
     orgStatusMessage: 'connection refused\nBuild info: version: \'3.4.0\', revision: \'unknown\', time: \'unknown\'\nSystem info: host: \'RITESHs-MacBook-Pro.local\', ip: \'192.168.1.2\', os.name: \'Mac OS X\', os.arch: \'x86_64\', os.version: \'10.13.6\', java.version: \'1.8.0_171\'\nDriver info: driver.version: FirefoxDriver\nremote stacktrace: stack backtrace:\n   0:        0x10b43d49e - backtrace::backtrace::trace::h3ab5720c483fe461\n   1:        0x10b43d4dc - backtrace::capture::Backtrace::new::h096accf58447e0d5\n2:        0x10b376534 - webdriver::error::WebDriverError::new::hc0958d01acda7bfc\n   3:        0x10b37d300 - geckodriver::marionette::MarionetteHandler::create_connection::h59a68c8dfef48e54\n   4:        0x10b35cd3c - _$LT$webdriver..server..Dispatcher$LT$T$C$$u20$U$GT$$GT$::run::h5a26ba0bb4fdb139\n   5:        0x10b3350c5 - std::sys_common::backtrace::__rust_begin_short_backtrace::h3f868f7a1a12bdcc\n   6:        0x10b33fd2d - std::panicking::try::do_call::hfce1ad2a948c3632\n   7:        0x10b4e9a5c - __rust_maybe_catch_panic\n   8:        0x10b352eb5 - _$LT$F$u20$as$u20$alloc..boxed..FnBox$LT$A$GT$$GT$::call_box::h651dedb755194a8c\n   9:        0x10b4e5c4b - std::sys::imp::thread::Thread::new::thread_start::h48c72bb09587cbc3\n  10:     0x7fff515f0660 - _pthread_body\n  11:     0x7fff515f050c - _pthread_start' } }

任何人都可以指导如何解决此错误?

1 个答案:

答案 0 :(得分:1)

似乎有些混乱。您已经提到:

  • 下载了最新的 Selenium-standalone-server版本3.14
  • 命令

    java -jar -Dwebdriver.gecko.driver=./geckodriver selenium-server-standalone-3.5.3.jar
                                observe the versioning ^^^ info
    
  • 日志消息反映:

    Build info: version: \'3.4.0\'
    

解决方案

  • 升级到当前水平Version 3.14.0
  • GeckoDriver 升级到GeckoDriver v0.22.0级。
  • Firefox 版本升级到 Firefox v62.0 级别。
  • 执行您的 test