WebDriverError:找不到dict'desiredCapabilities'

时间:2016-03-22 04:07:22

标签: node.js selenium selenium-webdriver babeljs

我正在使用selenium webdriver v2.53以及nodeJS v5.5,使用此组合,Chrome驱动程序无任何问题,当我添加mocha(v2.4.5)+ chai时,我得到以下错误堆栈

 WebDriverError: unknown error: cannot find dict 'desiredCapabilities'
  (Driver info: chromedriver=2.21.371459 (36d3d07f660ff2bc1bf28a75d1cdabed0983e7c4),platform=Windows NT 6.1 SP1 x86_64)
      at WebDriverError (D:\webrtc\licode-prototype\node_modules\selenium-webdriver\lib\error.js:26:26)
      at Object.checkLegacyResponse (D:\webrtc\licode-prototype\node_modules\selenium-webdriver\lib\error.js:639:15)
      at parseHttpResponse (D:\webrtc\licode-prototype\node_modules\selenium-webdriver\http\index.js:529:13)
      at D:\webrtc\licode-prototype\node_modules\selenium-webdriver\http\index.js:466:11
      at ManagedPromise.invokeCallback_ (D:\webrtc\licode-prototype\node_modules\selenium-webdriver\lib\promise.js:1343:14)
      at TaskQueue.execute_ (D:\webrtc\licode-prototype\node_modules\selenium-webdriver\lib\promise.js:2868:14)
      at TaskQueue.executeNext_ (D:\webrtc\licode-prototype\node_modules\selenium-webdriver\lib\promise.js:2851:21)
      at D:\webrtc\licode-prototype\node_modules\selenium-webdriver\lib\promise.js:2775:25
      at D:\webrtc\licode-prototype\node_modules\selenium-webdriver\lib\promise.js:639:7
      at run (D:\webrtc\licode-prototype\node_modules\esdoc\node_modules\core-js\modules\es6.promise.js:89:39)
      at D:\webrtc\licode-prototype\node_modules\esdoc\node_modules\core-js\modules\es6.promise.js:100:28
  From: Task: WebDriver.createSession()
      at acquireSession (D:\webrtc\licode-prototype\node_modules\selenium-webdriver\lib\webdriver.js:107:22)
      at Function.createSession (D:\webrtc\licode-prototype\node_modules\selenium-webdriver\lib\webdriver.js:338:12)
      at Driver (D:\webrtc\licode-prototype\node_modules\selenium-webdriver\chrome.js:778:38)
      at MyDriver (D:\webrtc\licode-prototype\test1\helper.js:44:16)
      at Context.<anonymous> (D:\webrtc\licode-prototype\test1\homepage.js:11:27)
      at callFn (D:\webrtc\licode-prototype\node_modules\mocha\lib\runnable.js:315:21)
      at Hook.Runnable.run (D:\webrtc\licode-prototype\node_modules\mocha\lib\runnable.js:308:7)
      at next (D:\webrtc\licode-prototype\node_modules\mocha\lib\runner.js:298:10)
      at Immediate._onImmediate (D:\webrtc\licode-prototype\node_modules\mocha\lib\runner.js:320:5)
  From: Task: WebDriver.navigate().to(https://localhostviewer?id=u7N5ZX4&room=4FOM1dA)
      at MyDriver.schedule (D:\webrtc\licode-prototype\node_modules\selenium-webdriver\lib\webdriver.js:387:17)
      at Navigation.to (D:\webrtc\licode-prototype\node_modules\selenium-webdriver\lib\webdriver.js:1030:25)
      at MyDriver.get (D:\webrtc\licode-prototype\node_modules\selenium-webdriver\lib\webdriver.js:798:28)
      at MyDriver.joinRTC (D:\webrtc\licode-prototype\test1\helper.js:78:17)

我将问题追溯到this github issue,是否有人可以告诉我如何修复它?

1 个答案:

答案 0 :(得分:0)

您可能已经重新配置了测试框架。

在幕后,您的框架应该像运行WebDriver一样执行POST请求(示例):

curl -XPOST http://localhost:4444/wd/hub/session -d '{"desiredCapabilities":{"browserName":"chrome","browserstack.selenium_version":"2.45.0","screen-resolution":"1280x1024","name":"tests/intern.js","idle-timeout":60}}'

所以它应该提供desiredCapabilities作为POST参数。

根据你的错误,这不会发生。