How can I get chromedriver to work properly with chrome in wsl2? - selenium-chromedriver

I am trying to run automated tests on a repository forked from here. I haven't really worked with yarn or mocha before (or chromedriver) so I'm going off of what the instructions are saying.
I've set up Ubuntu 18.04 in wsl2 and installed google-chrome-stable and chromedriver both at version 99.0.4844.51 in /usr/bin/. I have yarn start running in one terminal and when I try actually run yarn test it gives me:
SessionNotCreatedError: session not created: This version of ChromeDriver only supports Chrome version 94
Current browser version is 99.0.4844.51 with binary path /usr/bin/google-chrome-stable
I've tried upgrading chromedriver from here to version 100.0.4896.20 but it gives me the same error saying it only supports Chrome version 94. I'm having a hard time trying to find Google version 94 for linux, and I'll be happy either way, either upgrading the chromedriver or downgrading chrome.

Related

Unable to use correct ChromeDriver version

I am conducting QA automation testing. The code was running and working fine last week, but on restarting my computer over the weekend, it has stopped working with this error message:
Request failed with status 500 due to session not created:
This version of ChromeDriver only supports Chrome version 103
I assume it auto-updated Chrome when I restarted the laptop, as it's gone from version 103 to 105, which means I need to update my ChromeDriver.
I've done this before a few months ago, can't totally remember the steps I followed but I got it working. I possibly did something wrong then, as I can't seem to update ChromeDriver from 103 to 105.
I've tried to remove my current instance and reinstall the newer version by running:
npm uninstall chromedriver -g
npm install -g chromedriver --detect_chromedriver_version --scripts-prepend-node-path
Also tried the same having downloaded it from here:
https://chromedriver.storage.googleapis.com/index.html?path=105.0.5195.52/
and doing
npm install -g chromedriver --chromedriver_filepath=<PATH>
Also tried removing chromedriver from my package.json, doing an npm install, then adding it back in and doing an npm install. Each of these methods say they have installed the correct chromeDriver version (105.0.5195.52)
My package.json currently shows:
"dependencies": {
"chromedriver": "^105.0.0",
},
and when I do chromeDriver -v I see:
ChromeDriver 105.0.5195.52
Any ideas? If additional information is required please let me know. I know I could probably get around this by downgrading my Chrome version to 103, but I'd prefer to avoid that if possible.
On further investigation, I think it's something to do with selenium. Running my tests on their own works, but if I do selenium-standalone start and then run them, it's failing as above.
I've updated selenium by running:
npm install selenium-standalone#latest -g
npm install
Following that, when I try to start it, it's giving me an error that chromedriver is missing within the selenium node_modules folder.
A bit more investigation and I've found I also needed to run
selenium-standalone install
This did some updating, and then I was able to run
selenium-standalone start
All good now :)

TestCafe Update "local" Chrome in Jenkins

I am running tests in Jenkins and the tests are running on outdated Chrome 71 and I want to update the chrome it is using. I've tried updating my package.json to current TestCafe but it is still running 71. when I run node_modules/.bin/testcafe --version it just lists firefox, chrome. It seems that since the chrome is in node_modules I should be able to update to latest but I haven't found anything online to show how to do so.
Running locally on my machine chrome is v91. I thought doing an 'npm i' locally and pushing that branch would update but it was not successful.
Jenkins output:
npm i
node_modules/.bin/testcafe --version
1.15.0
node_modules/.bin/testcafe -e chrome:headless auth-subscriber-signs-in-validates-homepage.js
Running tests in: Chrome 71.0.3578.98 / Linux 0.0
TestCafe doesn't upgrade or downgrade browsers. It just searches the installed browsers and runs tests in them. You need to inspect the Jenkins job and found the way how browsers are installed for it.

How to update Chromium version on a cloned repository?

I have the latest version of Chromium installed globally, but right now I'm working on a cloned repository which has in node_modules\puppeteer\.local-chromium\win64-756035\chrome-win folder an older version of Chromium, and because of that I can't run e2e tests. How can I update it? I've tried to run the webdriver-manager update command but it doesn't work.
This is the error shown:
```E/launcher - session not created: This version of ChromeDriver only supports Chrome version 87
Current browser version is 83.0.4103.0 with binary path C:\Users\.....\Documents\.....\.....\node_modules\puppeteer\.local-chromium\win64-756035\chrome-win\chrome.exe
(Driver info: chromedriver=87.0.4280.20 (c99e81631faa0b2a448e658c0dbd8311fb04ddbd-refs/branch-heads/4280#{#355}),platform=Windows NT 10.0.19041 x86_64)```
Each release of puppeteer will install a specific version of Chromium in a directory similar to the path you posted. You can find out which version of Chromium will come with a version of puppeteer in their release notes.
webdriver-manager update will try to install the latest available version of the Chromium webdriver, I believe by checking the catalog of available versions, or more specifically https://chromedriver.storage.googleapis.com/LATEST_RELEASE. (Today, that's 91.0.4472.101). That version almost certainly won't correspond to the exact version of Chromium installed by puppeteer. You need to manually specify which version of the webdriver you want webdriver-manager to install by passing the flag --versions.chrome=x.y.z.
(My personal problem is that the webdriver catalog linked above does not actually include a webdriver for the release bundled with any of the recent puppeteer releases, so I'm sticking with v6.0.0 for now.)

Chrome version mismatch?

I have Google Chrome ver. 41.0.2272.118 and I decided to upgrade it.
I've dowloaded latest version of Google Chrome version 46.0.2490.86 :
Got:2 http://dl.google.com/linux/chrome/deb/ stable/main google-chrome-stable amd64 46.0.2490.86-1 [47,3 MB]
Then I check version from console:
maxim#maxim:/opt/google/chrome$ ./google-chrome -version
Google Chrome 46.0.2490.86
But when I run it
maxim#maxim:/opt/google/chrome$ ./google-chrome
and check About, it still show 41.0.2272.118
What did I do wrong?
I also had this similar problem on Linux Mint. I found the following solution to work.
Close all Chrome sessions
Update google-chrome using apt-get as you have done above
Move the config files from ~/.config/google-chrome to ~/.config/bkp_google-chrome
Start google-chrome and the new version should now be started.
Please note this will erase all your history, bookmarks etc

Chromedriver failing to launch or connect

Up until today, I have been using chromedriver to drive my watir-webdriver tests, and I have had no problems. My server still works and runs tests on the same version of the chromedriver and chrome.
I have tried updating to the latest chromedriver, which is the chromedriver 2 experimental build. This fails due to what I can only assume are still bugs being worked out of it.
I have also tried rolling back to the previous version of chromedriver with no success.
If anyone has any experience with this, I would really appreciate your expertise. I am sure it will turn out to be something simple I have overlooked.
gem versions:
watir-webdriver (0.6.2)
selenium-webdriver (2.29.0)
cucumber (1.2.1)
trace from the chromedriver below
Started ChromeDriver port=9517 version=26.0.1383.0
log=C:\Projects\oms_acceptance_tests\src\chromedriver.log
[6136:5300:0212/122320:ERROR:master_preferences.cc(110)] Failed to read master_preferences file at C:\Program Files (x86)\Google\Chrome\Application\master_preferences. Falling back to default preferences.
[6136:5300:0212/122320:ERROR:gpu_info_collector_win.cc(82)] Can't retrieve a valid WinSAT assessment.
test\automation\proxy_launcher.cc(107): error: Value of: app_launched
Actual: 5
Expected: AUTOMATION_SUCCESS
Which is: 0
Error while awaiting automation ping from browser process
[0212/122321:ERROR:proxy_launcher.cc(556)] Failed to ConnectToRunningBrowser
[0212/122321:ERROR:automation_proxy.cc(319)] Channel error in AutomationProxy.
Unable to either launch or connect to Chrome. Please check that ChromeDriver is up-to-date. Using Chrome binary at: C:\Program Files (x86)\Google\Chrome\Application\chrome.exe (Selenium::WebDriver::Error::UnknownError)
I would trying downloading newer version of chromedriver. Worked for me when I experienced similar issues.
To get rid of the gpu winsat error, try to update your display adapter.