session not created exception for chrome in Protractor
Protractor has a new release (4.0.10) that will use the new release of webdriver-manager (10.2.6), which in turn will update to the new Chromedriver when calling webdriver-manager update. All you need to do is update Protractor in your package.json file.
"protractor": "^4.0.9" to "protractor": "^4.0.10"
Hope this helps :)
You can change the version of chromedriver downloaded by webdriver-manager by altering Protractor's config.json file...
- Edit Protractor's config file: node_modules/protractor/config.json
- Change the chrome driver version to whatever you need. eg. "chromedriver": "2.24".
- Run webdriver-manager update.
from the error you posted, protractor is not using the latest chrome driver version.In stack trace it is displaying chrome driver version as 2.21
.
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.
I just needed to:
npm update -g protractor
webdriver-manager update
And it worked again.