如何在量角器测试中运行Firefox?

时间:2017-06-20 16:17:58

标签: testing protractor version

我试图运行测试,我在Firefox浏览器中看到一个空白的白色屏幕,当我关闭窗口时,我收到以下错误。

版本 Firefox:45.5.1 Selenium独立:3.4.0 Chromedriver 2.30 Geckodriver v0.17.0

[10:10:40] W/driverProviders - Using driver provider directConnect, but also found extra driver provider parameter(s): seleniumAddress
     [10:10:40] I/launcher - Running 1 instances of WebDriver
     [10:10:40] I/direct - Using FirefoxDriver directly...
     [10:11:06] E/launcher - Unable to parse new session response:   {"value":  {"error": "unknown error","message":"Failed to decode response from    marionette","stacktrace":"stack backtrace:\n 0:  0x4bd56f - <no info>\n 1: 0x4b
  dcc9 - <no info>\n   2:           0x449980 - <no info>\n   3:               0x4207bc
  - <no info>\n   4:           0x405e47 - <no info>\n   5:                0x6db3d9 -  <
    no info>\n   6:           0x417847 - <no info>\n   7:           0x6d56d3 - <no i
nfo>\n   8:         0x77a359cd - BaseThreadInitThunk"}}
   [10:11:06] E/launcher - WebDriverError: Unable to parse new session response: {"
value":{"error":"unknown error","message":"Failed to decode response from    marion
ette","stacktrace":"stack backtrace:\n   0:           0x4bd56f -  <no          info>\n   1
 :           0x4bdcc9 - <no info>\n   2:           0x449980 - <no info>\n   3:
    0x4207bc - <no info>\n   4:           0x405e47 - <no info>\n   5:
0x6db3d9 - <no info>\n   6:           0x417847 - <no info>\n   7:
 0x6d56d3 - <no info>\n   8:         0x77a359cd - BaseThreadInitThunk"}}
at WebDriverError (C:\npm\node_modules\protrac
    tor\node_modules\selenium-webdriver\lib\error.js:27:5)
at doSend.then.response (C:npm\node_modules\p
 rotractor\node_modules\selenium-webdriver\lib\http.js:445:19)
  at process._tickCallback (internal/process/next_tick.js:103:7)
 From: Task: WebDriver.createSession()
at Function.createSession (C:\npm\node_modules
\protractor\node_modules\selenium-webdriver\lib\webdriver.js:777:24)
at Function.createSession (C:\npm\node_modules
 \protractor\node_modules\selenium-webdriver\firefox\index.js:640:55)
  at Direct.getNewDriver (C:\node_modules\pr
  otractor\lib\driverProviders\direct.ts:112:25)
 at Runner.createBrowser (C:\node_modules\p
  rotractor\lib\runner.ts:225:39)
 at q.then.then (C\Users\node_modules\protractor
\lib\runner.ts:391:27)
at _fulfilled (C:\node_modules\protractor\
node_modules\q\q.js:834:54)
at self.promiseDispatch.done (C:\node_modu
les\protractor\node_modules\q\q.js:863:30)
at Promise.promise.promiseDispatch (C:\nod
 e_modules\protractor\node_modules\q\q.js:796:13)
at C:\node_modules\protractor\node_modules
 \q\q.js:556:49
at runSingle (C:\node_modules\protractor\n
 ode_modules\q\q.js:137:13)
 [10:11:06] E/launcher - Process exited with error code 199

Conf.js

exports.config = {
 seleniumAddress: 'http://127.0.0.1:4444/wd/hub',
  baseUrl: 'https://localhost:288020/',
  specs: ['index_spec.js'],
      directConnect: true,
capabilities: {
'browserName': 'firefox'
}
},
framework: 'jasmine2',
jasmineNodeOpts: {
defaultTimeoutInterval: 30000
},
onPrepare: function() {
browser.driver.manage().window().setSize(1366, 768);
}};

3 个答案:

答案 0 :(得分:1)

您需要使用最新版本的Firefox(至少大于51)才能使用Selenium 3.4和新的Firefox(Gecko)驱动程序。如果升级到最新版本,您将看到它可以正常工作

答案 1 :(得分:0)

从selenium 3.4开始,您无法使用较旧的firefox版本进行测试 如果您使用selenium版本3.01,3.1或3.2,那么即使您运行selenium 3,您仍然可以测试较旧的Firefox。

  • Firefox 48+:需要selenium版本3.0.1+
  • Firefox 47:仅适用于selenium版本2.53.1
  • Firefox 46:2.51.0 2.52.0 2.53.0
  • Firefox 44 - 45:2.48.2,2.49.0,2.51.0,2.52.0,2.53。
  • Firefox 39 - 43:2.47.1,2.48.2,2.49.0,2.51.0,2.52.0,2.53.0
  • Firefox 38:2.46.0
  • Firefox 32 - 37:2.45.0

答案 2 :(得分:0)

您可以通过更改Protractor的config.json文件来更改版本webdriver-manager下载:

  • 编辑量角器的配置文件: 的 node_modules /量角器/ config.json
  • 将硒版本更改为您需要的任何内容。例如。 “selenium”:“2.47.1”
  • 运行webdriver-manager更新