I get below error when try to run Protractor test against chrome.
My conf.ts
import {Config} from \'protractor\'
export let config: Config = {
f
I don't have enough rep yet to leave a comment under Sudharsan's answer but the location of the config file he is telling you to modify is actually at
node_modules/protractor/node_modules/webdriver-manager/config.json
It's not the protractor tsconfig but the webdriver-manager config.json
that you want to modify.
That being said, I've run into this problem before and taken a different approach to solving it. The solution that Sudharsan provided would work if you only needed to install it once. We have our builds running in TFS which cleans out the build agents working directory and pulls in a fresh repo on each build. Changing the webdriver config would not work in this situation because we npm install
all the things before each build. In this case it would always revert back to the older version of chromedriver.
What I did instead was added chromedriver to my devDependencies in the package.json
and then I delete the version of chromedriver that webdriver-manager installs and move the updated version of chromedriver into the correct location with a gulp task. So in the package.json I have this listed under devDependencies:
"chromedriver": "~2.24.1"
and then I have a gulp task that deletes and moves the files like this:
var gulp = require('gulp');
var del = require('del');
var chromeDriverFilesToMove = [
'./node_modules/chromedriver/lib/chromedriver/**'
];
var chromeDriverFilesToDelete = [
'./node_modules/protractor/node_modules/webdriver-manager/selenium/chromedriver*.exe',
'./node_modules/protractor/node_modules/webdriver-manager/selenium/chromedriver*.zip'
];
gulp.task('delete-chromedriver', function() {
return del(chromeDriverFilesToDelete);
});
gulp.task('move-chromedriver', function() {
gulp.src(chromeDriverFilesToMove)
.pipe(gulp.dest('node_modules/protractor/node_modules/webdriver-manager/selenium/'));
});
gulp.task('chromedriver-update', ['delete-chromedriver', 'move-chromedriver']);
And because protractor will still be looking for the older version of chromedriver that was installed when you ran webdriver-manager update
you have to tell it where to look for the chromedriver.exe so add this to your protractor conf.js and it should start working.
chromeDriver: "../node_modules/protractor/node_modules/webdriver-manager/selenium/chromedriver.exe",
It's kind of silly that we have to go through all this trouble to get it to work but chromedriver 2.22 doesn't seem to work with Chrome 53+. At least not in my experience.
TL;DR
If you only have to install it once use Sudharsan's solution (given you modify the correct config), it's easier. If you are in my situation and will have to install protractor continuously try my solution. It has worked well for me and I haven't run into this error since.