Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tests are failing after google chrome is upgraded to version 76

I am running tests using protractor(version 5.4.2) inside the docker file .After google chrome is upgraded to version 76 , tests have started to fail giving this error :

SessionNotCreatedError: session not created: Chrome version must be 
between 71 and 75
[chrome #01-2]   (Driver info: chromedriver=2.46.628388 (4a34a70827ac54148e092aafb70504c4ea7ae926),
platform=Linux 4.15.0-1040-aws x86_64)

I have tried couple of ways to solve that :

1) Tried to tag the chrome version to the previous version .But chrome moves to stable version and previous version is made chromium .
2) Also looked into some possible solutions online to download but its not working for me
3) webdriver-manager update --versions.chrome 76.0.3809.68 .Still protractor 5.4.2 picks up the chrome driver 2.46

Either I want to run the tests on chrome 75 so I need way to downgrade the chrome version or I want to know how can I make protractor compatible with chrome version 76

So far , what I have done is used webdriver-manager update on my local and when I run tests , its running fine but when I run tests inside the dockerFile which is also following the steps to clean and update the webdriver-manager , it goes back to use chrome driver 2.46 .Even webdriver clean removes chromedriver 76 itself

npx webdriver-manager clean
webdriver-manager: using local installed version 12.1.6
[11:01:36] I/file_manager - removed chromedriver_76.0.3809.12
[11:01:36] I/file_manager - removed chromedriver_76.0.3809.12.zip
[11:01:36] I/file_manager - removed geckodriver-v0.24.0
[11:01:36] I/file_manager - removed geckodriver-v0.24.0.tar.gz
[11:01:36] I/file_manager - removed selenium-server-standalone-3.141.59.jar
[11:01:36] I/file_manager - removed chrome-response.xml
[11:01:36] I/file_manager - removed gecko-response.json
[11:01:36] I/file_manager - removed standalone-response.xml
[11:01:36] I/file_manager - removed update-config.json
root@966d9b57465f:/opt# npx webdriver-manager update

npx webdriver-manager update gives again the same driver

webdriver-manager: using local installed version 12.1.6

and now when I run test :

[11:03:07] I/update - chromedriver: file exists /opt/node_modules/protractor/node_modules/webdriver-manager/selenium/chromedriver_2.46.zip
[11:03:07] I/update - chromedriver: unzipping chromedriver_2.46.zip
[11:03:08] I/update - chromedriver: setting permissions to 0755 for /opt/node_modules/protractor/node_modules/webdriver-manager/selenium/chromedriver_2.46
[11:03:08] I/update - chromedriver: chromedriver_2.46 up to date
[11:03:08] I/launcher - Running 2 instances of WebDriver
[11:03:09] I/testLogger -
------------------------------------

And if I remove the chrome driver 2.46 as it says exits above that file exists .So tests do not run

ode:1131) UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory, stat '/opt/node_modules/protractor/node_modules/webdriver-manager/selenium/chromedriver_2.46.zip'
    at Object.fs.statSync (fs.js:948:11) 

But same tests are running locally

like image 866
Dolly Agarwal Avatar asked Aug 01 '19 08:08

Dolly Agarwal


Video Answer


2 Answers

You can run following command before running the protractor test cases

" node ./node_modules/protractor/bin/webdriver-manager update --standalone false --gecko false --versions.chrome 2.44"

After this please run your end to end test cases.

This is how our package.json looks

"install-webmanager": " node ./node_modules/protractor/bin/webdriver-manager update --standalone false --gecko false --versions.chrome 2.44"

"e2e": "npm run install-webmanager && ng e2e"

So you just have to run

"npm run e2e"
like image 34
Omkar Porje Avatar answered Nov 12 '22 19:11

Omkar Porje


Google doesn't offer an easy way to work with old versions. The best way is to work with 76 and get the associated driver version.

Also, chrome drivers are not compatible with Chrome that is not same major version as the driver. For ex. driver v75 wont work with Chrome v76.

Chrome drivers are available here for download via driver-manager.

If you are looking for a specific version then clean old drivers and install intended version. You can use the following command(s)

npx webdriver-manager clean
npx webdriver-manager update --versions.chrome=76.0.3809.68

If you have webdriver-manager installed globally then use

webdriver-manager clean
webdriver-manager update --versions.chrome=76.0.3809.68

Hope that solves the issue with downloading the driver v76 and using it.

Note : With that, if the new driver is downloaded and protractor still fails (to run the tests) then please do update here. Issue then could likely be with webdriver-manager (version you are using) having problem with chrome driver v76.

like image 153
Rakesh Kumar Cherukuri Avatar answered Nov 12 '22 20:11

Rakesh Kumar Cherukuri