setup-chrome
setup-chrome copied to clipboard
BUG: existing chrome in github runner is not updated
I'm trying to use chromedriver in a github action.
I update my chromedriver version more frequently than GitHub is updating the Chrome version in their runner.
Which sometimes results in the following error:
[0-0] webdriver: Request failed with status 500 due to session not created: This version of ChromeDriver only supports Chrome version 111 [0-0] Current browser version is 110.0.5481.177 with binary path /usr/bin/google-chrome
Using your action to update the chrome version installed in the runner doesn't help as the new version is installed in ./opt/google and this location is looked last by chromedriver (chrome_finder.cc#line62).
I am experiencing this as well, is there a workaround for this @ueokande?
Thank you for your inquiry. chromedriver discover browser's location from PATH and /usr/bin/google-chrome is used first from your logs. I found the following document. Is that helpful to you?
https://chromedriver.chromium.org/capabilities#h.p_ID_64
Thank you for your inquiry. chromedriver discover browser's location from PATH and
/usr/bin/google-chromeis used first from your logs. I found the following document. Is that helpful to you?https://chromedriver.chromium.org/capabilities#h.p_ID_64
Sorry I don't follow quite yet on the relevance of that, as it looks like the runner looks in Applications/Google Chrome.app/Contents/MacOS/Google Chrome for the path right now, and this tool installs to Users/runner/hostedtoolcache/chromium/latest/x64/Chromium.app/Contents/MacOS/Chromium.
Sample run: https://github.com/IntelliTect/TestTools.Selenate/actions/runs/4482277716/jobs/7880104726
@BenjaminMichaelis Your situation is similar to the original author's one. You need to install chromedriver v113 to to launch chrome v113 (see also Version Selection). Then, add a binary path:
ChromeOptions options = new ChromeOptions();
options.BinaryLocation = "path/to/chrome";
The action outputs a full path of installed chrome to parameter chrome-path. This is helpful to known where chrome is installed in.
@ueokande, thanks for your reply!
I'm using a library called webdriver.io which itself uses chromedriver (so I don't have access to any configurations nor can I write any code to change the actual chrome path). Also using PATH env seems to be something still not implemented in chromedriver.
Actually Chromedriver is looking in this particular order to find an installed version of Chrome:
1. "/usr/local/sbin"
2. "/usr/local/bin"
3. "/usr/sbin"
4. "/usr/bin" // <-- Github's runner install Chrome here (ie. /usr/bin/google-chrome)
5. "/sbin"
6. "/bin"
7. "/opt/google/chrome" // <-- your Github action install Chrome here
8. "/opt/chromium.org/chromium"
So by default, Chromedriver will always pick up the Github runner Chrome version (which could be outdated).
But besides Chromedriver, I think this is something that can occur with other librairies, applications, scripts, etc.
So IMO it would be great to:
- make sure your action always override the actual Github runner Chrome version (to avoid any conflicting installations, like in my case)
- provide an option to the action to choose where to install Chrome
What do you think ?
@ueokande, thanks for your reply!
I'm using a library called webdriver.io which itself uses chromedriver (so I don't have access to any configurations nor can I write any code to change the actual chrome path). Also using PATH env seems to be something still not implemented in chromedriver.
Actually Chromedriver is looking in this particular order to find an installed version of Chrome:
1. "/usr/local/sbin" 2. "/usr/local/bin" 3. "/usr/sbin" 4. "/usr/bin" // <-- Github's runner install Chrome here (ie. /usr/bin/google-chrome) 5. "/sbin" 6. "/bin" 7. "/opt/google/chrome" // <-- your Github action install Chrome here 8. "/opt/chromium.org/chromium"So by default, Chromedriver will always pick up the Github runner Chrome version (which could be outdated).
But besides Chromedriver, I think this is something that can occur with other librairies, applications, scripts, etc.
So IMO it would be great to:
- make sure your action always override the actual Github runner Chrome version (to avoid any conflicting installations, like in my case)
- provide an option to the action to choose where to install Chrome
What do you think ?
I found that https://github.com/nanasess/setup-chromedriver seems to work for me! (https://github.com/IntelliTect/TestTools.Selenate/pull/30)
@BenjaminMichaelis, the issue is related to the browser version not the driver version but thanks for the share anyway 😉
Manual solution (for anyone interested)
I got tired of this bug so I'm now updating Chrome in github action runners myself.
- name: Install latest Chrome (Windows)
if: ${{ runner.os == 'Windows' }}
run: |
$ChromeInstallerFile = "googlechromestandaloneenterprise64.msi"
$ChromeInstallerUrl = "https://dl.google.com/tag/s/dl/chrome/install/${ChromeInstallerFile}"
$ChromeInstallerPath = Join-Path -Path "${env:Temp}" -ChildPath $ChromeInstallerFile
(New-Object System.Net.WebClient).DownloadFile($ChromeInstallerUrl, $ChromeInstallerPath)
Start-Process -FilePath msiexec.exe -ArgumentList "/i $ChromeInstallerPath /QN /norestart" -Wait -PassThru
- name: Install latest Chrome (Linux)
if: ${{ runner.os == 'Linux' }}
run: |
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
sudo sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list'
sudo apt-get update
sudo apt-get install google-chrome-stable
- name: Install latest Chrome (macOS)
if: ${{ runner.os == 'macOS' }}
run: |
wget -q https://dl.google.com/chrome/mac/universal/stable/GGRO/googlechrome.dmg
hdiutil attach -quiet -noautofsck -noautoopen googlechrome.dmg
sudo cp -r /Volumes/Google\ Chrome/Google\ Chrome.app /Applications/