How to downgrade Chrome WebDriver in angular Protractor

For who runs into this and would like to use chrome 77, here are the steps:

  • npm i protractor@^5.4.2
  • node node_modules/.bin/webdriver-manager update --versions.chrome=77.0.3865.75
  • make sure that the specified version match in protractor.conf.js under the chromeDriver key.

Here's my protractor config:

exports.config = {
  allScriptsTimeout: 11000,
  specs: ['./src/**/*.e2e-spec.ts'],
  capabilities: {
    browserName: 'chrome',
  },
  chromeDriver: '../node_modules/protractor/node_modules/webdriver-manager/selenium/chromedriver_77.0.3865.75',
  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.json'),
    });
    jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
  },
};

I also added the following script in package.json:

 "postinstall": "node_modules/.bin/webdriver-manager update --versions.chrome=77.0.3865.75"

to make sure to have the correct version after each installation.



If you are using Angular and need to run end-to-end tests, maybe you need a different approach.

Setting version of ChromeDriver

  • cd <project>/node_modules/.bin/

  • node webdriver-manager update --versions.chrome 80.0.3987.106 --gecko false --standalone false

Setting --gecko and --standalone to false will prevent them from downloading and will just download chromedriver.

Running e2e tests

  • npx ng e2e --webdriverUpdate=false //in project folder

--webdriverUpdate=false Don't try update webdriver

References

webdriver manager docs

ngn e2e docs