How to update Chromium version on a cloned repository? - puppeteer

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.)

Related

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

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.

How to auto update chromedriver in webdriverIO

I have an automation framework developed using webdriverIO. The issue is all test cases start failing whenever chrome updated as chromedriver didn't update automatically.
This version of ChromeDriver only supports Chrome version 92
is there any way that ChromeDriver updated automatically whenever there is new available
Please note down latest version of Chrome (Help > About Google Chrome )
then check your package.json file where we have line like
"chromedriver": "^98.0.0",
update above line with latest chrome version like
"chromedriver": "^100.0.0",
then run command
npm install
Use the following commands this will auto-update all the JSON dependencies to the latest version
To update to the latest version
npx npm-check-updates -u
npm install and npm install chromedriver --save-dev

How can I download Appropriate Chromedriver in Protractor using Webdriver-Manager

I have designed a cucumber-protractor based automation framework where everything is working fine except for the Webdriver-manager. I need to update the binaries manually each time the IT Department updates google chrome version.
When i use command "webdriver-manager update --proxy=http://someproxy.com:PORT#", webdriver-manager always downloads the latest chromdriver binaries instead of a compatible version as per the current Chrome Version.
Please help me if there is a way to determine the chrome version automatically and download the corresponding Chrome binaries.
I have tried to search for similar behavior and forums elsewhere but none of the commands work. Instead it always downloads the latest version of chromedriver binaries instead of a compatible one.
Please help with some sample code in-case you come through a solution to this.
You could run a sh prior to starting your tests that will determine wether the chromedriver needs to be updated:
#!/bin/bash
# get existing chromedriver version
EXISTING_CD_VERSION=$(node_modules/.bin/chromedriver -version | egrep -o '(\d+)\.(\d+)\.(\d+)')
# get installed Google Chrome version
CHROME_VERSION=$(/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --version | egrep -o '(\d+)\.(\d+)\.(\d+)')
if [ "$EXISTING_CD_VERSION" = "$CHROME_VERSION" ]; then
echo "ChromeDriver version matches the Google Chrome version"
else
NEW_CD_VERSION=$(curl https://chromedriver.storage.googleapis.com/LATEST_RELEASE_$CHROME_VERSION)
node_modules/.bin/webdriver-manager update --versions.chrome $NEW_CD_VERSION
fi
NOTE: The script above is getting the Google Chrome version from a MacOS system. If you're on Linux, you need to change that to google-chrome --version
https://github.com/angular/webdriver-manager/blob/legacy/docs/versions.md
webdriver-manager start --versions.chrome 87.0.4280.88
you can use --versions.chrome to specify the driver version
what you actually need to do is to match a version of your local chrome to the version of chromedriver. So
First, find out what your version of chrome is. From example it is 86.0.4240.111
Then, find out what chromedriver version can be used. Take the major version of the browser (first 3 numbers, 86.0.4240 in our case) and find the corresponding version of the driver by going to this url https://chromedriver.storage.googleapis.com/LATEST_RELEASE_${CHROME_VERSION} (put the major browser version instead of ${CHROME_VERSION}). You'll see the chromedriver you're looking for is 86.0.4240.22
then just update webdriver specifying the desired version of chromedriver
webdriver-manager update --gecko=false --versions.chrome $VERSION
Make sure to put 86.0.4240.22 instead of $VERSION
But it maybe tricky here because there are 2 installation of protractor usually:
local
global
and each has it's own webdriver-manager. So make sure you're updating the right one
Thus you may need to go to it's folder and from that folder run npm i webdriver-manager#latest and then node ./bin/webdriver-manager update --gecko=false
when you updated the right webdriver, install the right chromedriver like so
node ./bin/webdriver-manager update --gecko=false --versions.chrome $VERSION

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

How can I downgrade to Chrome 42.0.2311.90?

Google Chrome on my machine recently got updated to v44.
I'm working with Selenium WebDriver on Chrome and as soon as I updated Chrome, all my tests went dead. I use Chromedriver v2.16. My partner's PC has Chrome v42.0.2311.90 and Chromedriver v2.16. And tests run fine on his machine. Now, based on this I'm pretty sure the problem is probably not with Chromedriver.
So, how can I downgrade to Chrome 42.0.2311.90?
I've tried using an offline installer from here:
Google Chrome Alternate Offline Installer
But this always gives me the latest version to install i.e. v44.
The release that I need can be found here:
Google Chrome v42.0.2311.90 Stable Channel Update
Uninstall your current chrome version.
Remove all Chrome data for current version from: C:\Users\username\AppData\Local\Google\Chrome
Download your particular version from chrome_installer.
Disable chrome updates using instructions given on this link.
Following steps help you to install your desired google chrome version :
1 - Uninstall your current google chrome version.
2 - Download your desired google chrome version from here : Google Chrome Download
3 - Restart PC once so if any registry or temp file stored of previous google chrome then it will get refresh.
4 - Install your downloaded google chrome. And then turn off automatic chrome update.
I struggled with this same problem on Mac, trying to downgrade, and stay downgraded from Chrome 53 to 52 due to a serious bug affecting webaudio.
None of the other recommendation appear to apply any more (or on Mac OS X at least). The app attempts to upgrade itself and there doesn't be a way to configure that in a "Chrome-friendly" way.
Eventually I resorted to force...
Close and uninstall Chrome
Edit your /etc/hosts file to prevent update checks from working by overriding the DNS entry:
0.0.0.0 tools.google.com
Find and download an old release. This is left as an exercise, this was actually hard and fraught with fear of bad binaries. I was able to cross-reference MD5s from one site that didn't have downloads with another that had downloads.
Install and run the older version
Important: Check the "About" page, and point and laugh at Chrome's attempts to check in.
This is how you can use an older chrome version "in general":
Uninstall your current chrome
Install the chrome version you desire
DO NOT open chrome!! after installation
Instead disable auto-updates like here or here
Only then may you work with your desired chrome browser version
As for how to get a specific older version:
You need to google, search forums or try sites like this. It's just "grunt work" to find the version you are looking for. If you're extremely unlucky, the very version you need might even not be around any more.
If you are running on a windows machine you can leverage the package manager chocolatey, this is how we I'm doing it from Jenkins, we call a powershell that uninstalls a previous version and install a specific one: From a powershell ide script window, you need to have installed the modules for chocolatey that is a small price to pay for a lot of benefit:
choco install googlechrome --version 62.0.3202.94 -y
Then to prevent Chrome to self update I am performing this steps:
1. Verify Chrome's current version.
(Get-Item (Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\chrome.exe').'(Default)').VersionInfo
Install the version I'm aiming for:
choco install googlechrome --version 62.0.3202.94 -y
You can look for available versions here:
https://chocolatey.org/packages/GoogleChrome
(Find Version History Section)
Kill GoogleCrashHandler.exe in any of its variants 32 or 64 bits or both.
Delete the Directories
C:\Program Files (x86)\Google\Update and
C:\Program Files (x86)\Google\CrashReporter
You will loose the ability to auto update (which is the whole purpose right) and
you will loose the ability to send crash reports and piggy back on that executable to update against your will whenever google deems convenient.
5.Disable Chrome Services