Как понизить Chrome WebDriver в угловом транспортире - PullRequest
0 голосов
/ 11 июня 2019

Я пытаюсь запустить ng e2e на Angular 7 с Chrome в качестве браузера.Я запускал команды npm install -g protractor и webdriver-manager update.В итоге происходит загрузка и запуск chromedriver = 76.0.3809.12, но я не могу обновить сам Chrome на моей машине.У меня Chrome 74.

Я пробовал webdriver-manger update, webdriver-manager update --versions.chrome 2.46 и webdriver-manager update --versions.chrome 74.0.3729.6, но даже если я иду и удаляю файлы chrome 76 из node_modules\protractor\node_modules\webdriver-manager\selenium\, они всегда переустанавливаются при каждом запуске ng e2e

protractor.conf.js

exports.config = {
  allScriptsTimeout: 11000,
  specs: [
    './src/**/*.e2e-spec.ts'
  ],
  capabilities: {
    'browserName': 'chrome'
  },
  directConnect: true,
  baseUrl: 'http://localhost:4200/',
  framework: 'jasmine',
  jasmineNodeOpts: {
    showColors: true,
    defaultTimeoutInterval: 30000,
    print: function() {}
  },
  onPrepare() {
    require('ts-node').register({
      project: require('path').join(__dirname, './tsconfig.e2e.json')
    });
    jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
  }
};

tsconfig.e2e.json

{
  "extends": "../tsconfig.json",
  "compilerOptions": {
    "outDir": "../out-tsc/app",
    "module": "commonjs",
    "target": "es5",
    "types": [
      "jasmine",
      "jasminewd2",
      "node"
    ]
  }
}

при попытке запустить ng e2e выдает эту ошибку:

E/launcher - session not created: This version of ChromeDriver only supports Chrome version 76
  (Driver info: chromedriver=76.0.3809.12 (220b19a666554bdcac56dff9ffd44c300842c933-refs/branch-heads/3809@{#83}),platform=Windows NT 10.0.16299 x86_64)
E/launcher - Process exited with error code 199
An unexpected error occurred: undefined

ОБНОВЛЕНИЕ: когда я запустил webdriver-manager clean и node node_modules/protractor/bin/webdriver-manager update --standalone --versions.standalone=3.8.0, он все еще загрузил Chrome 76, здесь вывод второй команды и ng e2e после чистого

узла node_modules / protractor /Обновление bin / webdriver-manager --standalone -

versions.standalone=3.8.0
[06:59:13] I/config_source - curl -oM:.\node_modules\protractor\node_modules\webdriver-manager\selenium\standalone-response.xml https://selenium-release.storage.googleapis.com/
[06:59:13] I/config_source - curl -oM:.\node_modules\protractor\node_modules\webdriver-manager\selenium\chrome-response.xml https://chromedriver.storage.googleapis.com/
[06:59:13] I/config_source - curl -oM:.\node_modules\protractor\node_modules\webdriver-manager\selenium\gecko-response.json https://api.github.com/repos/mozilla/geckodriver/releases
[06:59:14] I/downloader - curl -oM:.\node_modules\protractor\node_modules\webdriver-manager\selenium/selenium-server-standalone-3.8.0.jar https://selenium-release.storage.googleapis.com/3.8/selenium-server-standalone-3.8.0.jar
[06:59:14] I/update - chromedriver: file exists M:.\node_modules\protractor\node_modules\webdriver-manager\selenium\chromedriver_76.0.3809.12.zip
[06:59:14] I/update - chromedriver: unzipping chromedriver_76.0.3809.12.zip
[06:59:14] I/update - chromedriver: chromedriver_76.0.3809.12.exe up to date
[06:59:14] I/update - geckodriver: file exists M:.\node_modules\protractor\node_modules\webdriver-manager\selenium\geckodriver-v0.24.0.zip
[06:59:14] I/update - geckodriver: unzipping geckodriver-v0.24.0.zip
[06:59:15] I/update - geckodriver: geckodriver-v0.24.0.exe up to date

ng e2e

i 「wdm」: Compiled successfully.
[07:00:51] I/update - chromedriver: file exists M:.\node_modules\protractor\node_modules\webdriver-manager\selenium\chromedriver_76.0.3809.12.zip
[07:00:51] I/update - chromedriver: unzipping chromedriver_76.0.3809.12.zip
[07:00:52] I/update - chromedriver: chromedriver_76.0.3809.12.exe up to date
[07:00:54] I/launcher - Running 1 instances of WebDriver
[07:00:54] I/direct - Using ChromeDriver directly...
[9224:10012:0612/070058.684:ERROR:configuration_policy_handler_list.cc(90)] Unknown policy: EnableCommonNameFallbackForLocalAnchors
[9224:10012:0612/070058.869:ERROR:configuration_policy_handler_list.cc(90)] Unknown policy: EnableCommonNameFallbackForLocalAnchors

DevTools listening on ws://127.0.0.1:5007/devtools/browser/376b234b-f47d-4841-afdc-77719714db23
[07:01:05] E/launcher - session not created: This version of ChromeDriver only supports Chrome version 76
  (Driver info: chromedriver=76.0.3809.12 (220b19a666554bdcac56dff9ffd44c300842c933-refs/branch-heads/3809@{#83}),platform=Windows NT 10.0.16299 x86_64)
[07:01:05] E/launcher - SessionNotCreatedError: session not created: This version of ChromeDriver only supports Chrome version 76
  (Driver info: chromedriver=76.0.3809.12 (220b19a666554bdcac56dff9ffd44c300842c933-refs/branch-heads/3809@{#83}),platform=Windows NT 10.0.16299 x86_64)

package.json

  "private": true,
  "dependencies": {
    "@angular/animations": "^7.2.14",
    "@angular/cdk": "^7.3.7",
    "@angular/common": "^7.2.14",
    "@angular/compiler": "^7.2.14",
    "@angular/core": "^7.2.14",
    "@angular/forms": "^7.2.14",
    "@angular/http": "^7.2.14",
    "@angular/material": "^7.3.7",
    "@angular/platform-browser": "^7.2.14",
    "@angular/platform-browser-dynamic": "^7.2.14",
    "@angular/platform-server": "^7.2.14",
    "@angular/router": "^7.2.14",
    "core-js": "^2.5.7",
    "rxjs": "^6.5.2",
    "rxjs-compat": "^6.5.1",
    "zone.js": "^0.8.29"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "^0.13.8",
    "@angular/cli": "^7.3.8",
    "@angular/compiler-cli": "^7.2.14",
    "@angular/language-service": "^7.2.14",
    "@types/jasmine": "^3.3.12",
    "@types/jasminewd2": "~2.0.3",
    "@types/node": "^11.13.8",
    "codelyzer": "^5.0.1",
    "jasmine-core": "^3.4.0",
    "jasmine-spec-reporter": "^4.2.1",
    "karma": "^4.1.0",
    "karma-chrome-launcher": "^2.2.0",
    "karma-cli": "^2.0.0",
    "karma-coverage-istanbul-reporter": "~2.0.0",
    "karma-jasmine": "^2.0.1",
    "karma-jasmine-html-reporter": "^1.4.2",
    "protractor": "^5.4.2",
    "rxjs-tslint": "^0.1.7",
    "ts-node": "~5.0.1",
    "tslint": "^5.16.0",
    "typescript": "<3.3.0",
    "webpack": "^4.30.0"
  }

1 Ответ

0 голосов
/ 12 июня 2019

Попробуйте опцию ниже

webdriver-manager clean // This will clean the existing webdrivers

node node_modules/protractor/bin/webdriver-manager update --standalone --versions.standalone=3.8.0
...