Protractor不支持Firefox 50.1

时间:2016-12-14 13:04:03

标签: selenium-webdriver npm protractor

我的量角器测试在Chrome中运行良好,但我遇到了Firefox问题。

这是我的量角器conf:

// Protractor configuration file, see link for more information
// https://github.com/angular/protractor/blob/master/docs/referenceConf.js

/*global jasmine */
var SpecReporter = require('jasmine-spec-reporter');

exports.config = {
  allScriptsTimeout: 11000,
  specs: [
    './e2e/**/*.e2e-spec.ts'
  ],
  capabilities: {
    'browserName': 'firefox'
  },
  directConnect: true,
  baseUrl: 'http://dummyUrl.com',
  framework: 'jasmine',
  jasmineNodeOpts: {
    showColors: true,
    defaultTimeoutInterval: 30000,
    print: function() {}
  },
  useAllAngular2AppRoots: true,
  beforeLaunch: function() {
    require('ts-node').register({
      project: 'e2e'
    });
  },
  onPrepare: function() {
    jasmine.getEnv().addReporter(new SpecReporter());
  }
};

这是我的package.json

"name": "project-view",
  "version": "0.0.0",
  "license": "MIT",
  "angular-cli": {},
  "scripts": {
    "start": "ng serve",
    "lint": "tslint \"src/**/*.ts\"",
    "test": "ng test",
    "pree2e": "webdriver-manager update",
    "e2e": "protractor"
  },
  "private": true,
  "dependencies": {
    "@angular/common": "~2.1.0",
    "@angular/compiler": "~2.1.0",
    "@angular/core": "~2.1.0",
    "@angular/forms": "~2.1.0",
    "@angular/http": "~2.1.0",
    "@angular/platform-browser": "~2.1.0",
    "@angular/platform-browser-dynamic": "~2.1.0",
    "@angular/router": "~3.1.0",
    "bootstrap": "^3.3.7",
    "core-js": "^2.4.1",
    "ng2-bootstrap": "^1.1.16",
    "rxjs": "5.0.0-beta.12",
    "ts-helpers": "^1.1.1",
    "zone.js": "^0.6.23"
  },
  "devDependencies": {
    "@types/jasmine": "^2.2.30",
    "@types/node": "^6.0.42",
    "angular-cli": "1.0.0-beta.19-3",
    "codelyzer": "1.0.0-beta.1",
    "jasmine-core": "2.4.1",
    "jasmine-spec-reporter": "2.5.0",
    "karma": "1.2.0",
    "karma-chrome-launcher": "^2.0.0",
    "karma-cli": "^1.0.1",
    "karma-coverage": "^1.1.1",
    "karma-istanbul-threshold": "^1.2.2",
    "karma-jasmine": "^1.0.2",
    "karma-remap-istanbul": "^0.2.1",
    "path": "^0.12.7",
    "protractor": "4.0.9",
    "ts-node": "1.2.1",
    "tslint": "3.13.0",
    "typescript": "~2.0.3",
    "webdriver-manager": "10.2.5"
}

最后,这是我在尝试运行量角器测试时的错误日志:

[13:46:02] I/update - chromedriver: unzipping chromedriver_2.24win32.zip
[13:46:02] I/update - chromedriver: v2.24 up to date
[13:46:03] W/file_manager - geckodriver-v0.9.0-win64.zip expected length undefined, found 2202503
[13:46:03] W/file_manager - removing file: D:\CS2_Project\CS2-ProjectManagement\node_modules\webdriver-manager\selenium\geckodriver-v0.9.0-win64.zip
[13:46:03] I/downloader - geckodriver: downloading version v0.9.0
[13:46:03] I/downloader - curl -o D:\CS2_Project\CS2-ProjectManagement\node_modules\webdriver-manager\selenium/geckodriver-v0.9.0-win64.zip https://github.com/mozilla/geckodriver/rele
ases/download/v0.9.0/geckodriver-v0.9.0-win64.zip
[13:46:05] I/update - geckodriver: unzipping D:\CS2_Project\CS2-ProjectManagement\node_modules\webdriver-manager\selenium\geckodriver-v0.9.0-win64.zip

> project-view@0.0.0 e2e D:\CS2_Project\CS2-ProjectManagement
> protractor

(node:8524) DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpdir() instead.
[13:46:06] I/direct - Using FirefoxDriver directly...
[13:46:06] I/launcher - Running 1 instances of WebDriver
[13:46:52] E/launcher - Timed out waiting for the WebDriver server at http://127.0.0.1:21431/hub
[13:46:52] E/launcher - Error: Timed out waiting for the WebDriver server at http://127.0.0.1:21431/hub
    at onError (D:\CS2_Project\CS2-ProjectManagement\node_modules\protractor\node_modules\selenium-webdriver\http\util.js:87:11)
    at ManagedPromise.invokeCallback_ (D:\CS2_Project\CS2-ProjectManagement\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:1379:14)
    at TaskQueue.execute_ (D:\CS2_Project\CS2-ProjectManagement\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:2913:14)
    at TaskQueue.executeNext_ (D:\CS2_Project\CS2-ProjectManagement\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:2896:21)
    at asyncRun (D:\CS2_Project\CS2-ProjectManagement\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:2775:27)
    at D:\CS2_Project\CS2-ProjectManagement\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:639:7
    at process._tickCallback (internal/process/next_tick.js:103:7)
From: Task: WebDriver.createSession()
    at Function.createSession (D:\CS2_Project\CS2-ProjectManagement\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver.js:329:24)
    at Driver (D:\CS2_Project\CS2-ProjectManagement\node_modules\protractor\node_modules\selenium-webdriver\firefox\index.js:386:38)
    at Direct.getNewDriver (D:\CS2_Project\CS2-ProjectManagement\node_modules\protractor\built\driverProviders\direct.js:75:26)
    at Runner.createBrowser (D:\CS2_Project\CS2-ProjectManagement\node_modules\protractor\built\runner.js:198:43)
    at D:\CS2_Project\CS2-ProjectManagement\node_modules\protractor\built\runner.js:277:30
    at _fulfilled (D:\CS2_Project\CS2-ProjectManagement\node_modules\q\q.js:834:54)
    at self.promiseDispatch.done (D:\CS2_Project\CS2-ProjectManagement\node_modules\q\q.js:863:30)
    at Promise.promise.promiseDispatch (D:\CS2_Project\CS2-ProjectManagement\node_modules\q\q.js:796:13)
    at D:\CS2_Project\CS2-ProjectManagement\node_modules\q\q.js:556:49
    at runSingle (D:\CS2_Project\CS2-ProjectManagement\node_modules\q\q.js:137:13)
[13:46:52] E/launcher - Process exited with error code 199

npm ERR! Windows_NT 6.2.9200
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "e2e"
npm ERR! node v7.1.0
npm ERR! npm  v3.10.9
npm ERR! code ELIFECYCLE
npm ERR! project-view@0.0.0 e2e: `protractor`
npm ERR! Exit status 199
npm ERR!
npm ERR! Failed at the project-view@0.0.0 e2e script 'protractor'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the project-view package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     protractor
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs project-view
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls project-view
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     D:\CS2_Project\CS2-ProjectManagement\npm-debug.log

有人可以帮忙吗?

3 个答案:

答案 0 :(得分:0)

找到此链接可能对您有所帮助:https://github.com/angular/protractor/issues/3182

我认为这与directConnect有关。

请检查您使用的版本是否支持Firefox marionette driver,否则您将无法使用directConnect运行。

答案 1 :(得分:0)

量角器目前建议使用FF 47.由于Marionette / Gecko驱动程序支持问题,目前不支持FF 48+。目前开放的github问题正在跟踪此问题:https://github.com/angular/protractor/issues/3750

答案 2 :(得分:0)

这对我有用:

  capabilities: {
    browserName: 'firefox',
    marionette: true
  }

我必须添加:marionette: true。我知道这是基础知识,但也许它会对某人有所帮助。