4

I use CI/CD Gitlab with this script but my Chrome webdriver version is setted in my Maven project (pom.xml):

  before_script:
    ##########################
    # Install  gnupg2        #
    ##########################
    - apt-get install -y gnupg2

    ##################################################
    # Install Latest Google chrome package on system #
    ##################################################
    - curl -sS -o - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add
    - echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list
    - apt-get -y update
    - apt-get -y install google-chrome-stable

Using the latest version of chrome, I have to change the version of my webdriver in my pom.xml file. how can i force the chrome 80.0.3987.106 version for example?

EDIT:

I try script install chrome from zip file but do not work (/usr/bin/google-chrome is default path use by Chrome webdriver). Pipeline execution stops during/at the end of the unzip command

variables:
    CHROMIUM_URL: https://www.googleapis.com/download/storage/v1/b/chromium-browser-snapshots/o/Linux_x64%2F722276%2Fchrome-linux.zip?alt=media

before_script:
    ##########################
    # Install  gnupg2        #
    ##########################
    - apt-get install -y gnupg2
    
    ##################################################
    # install Chrome 80.0.3987.106
    ##################################################
    - apt-get install zip unzip
    - apt-get install wget
    - apt-get -y install libglib2.0-0
    - apt-get -y install libnss3-dev
    - apt-get -y install libx11-dev
    - wget --output-document chrome-linux64.zip -nv "${CHROMIUM_URL}"
    - unzip -j ./chrome-linux64.zip -d /usr/bin/google-chrome
    - export CHROME_BIN=/usr/bin/google-chrome/chrome

EDIT 2:

I try script install chrome from deb file but do not work.

- apt-get install wget
- wget --output-document chromium-browser.deb -nv http://security.ubuntu.com/ubuntu/pool/universe/c/chromium-browser/chromium-browser_80.0.3987.163-0ubuntu1_amd64.deb
- ls -lrt
- apt install -y ./chromium-browser.deb
Community
  • 1
  • 1
Stéphane GRILLON
  • 11,140
  • 10
  • 85
  • 154

1 Answers1

1

It seems you want to install a specific version of Google Chrome using apt-get package manager. You can easily do it in this way:

apt-get -y install google-chrome-stable=VERSION

For example:

apt-get -y install google-chrome-stable=80.0.3987.106


EDIT:

Since Google removes all older versions of Chrome from the PPA and from their download site, the above solution will not be useful.
But it can be suggested to Download .deb file of current version of Google Chrome and upload it on a personal repository. Then you can download and install it in your pipeline whenever you want regardless of Google Chrome's future changes and updates.

Amir Dadkhah
  • 1,074
  • 2
  • 11
  • 17
  • I can read this error: `E: Version '80.0.3987.106' for 'google-chrome-stable' was not found`. Should i modify the `curl` command just before? – Stéphane GRILLON May 25 '20 at 08:19
  • I'm so sorry about my answer. It seems installing specific chrome browser versions are not possible using the official dl.google.com repository. Google removes all but the latest version from the PPA and from their download site. I thought older versions of Google Chrome are available but when I checked it using `apt-cache policy google-chrome-stable`, I realized that there is just one version (the latest). I will edit my answer soon. – Amir Dadkhah May 25 '20 at 08:33
  • So, is not possible to find old version of chrome? – Stéphane GRILLON May 25 '20 at 10:09
  • 1
    It is not possible from official website and PPA repository. Maybe some unofficial sources are providing stable channel releases. But it is not easy and safe to trust them. Anyway, if you can use Chromium browser instead of Google Chrome, please read this post: [Where can I download old stable builds of Chromium from?](https://superuser.com/questions/920523/) – Amir Dadkhah May 25 '20 at 11:52
  • 1
    I find link to download but after I need unzippe and install? https://www.googleapis.com/download/storage/v1/b/chromium-browser-snapshots/o/Linux_x64%2F722276%2Fchromedriver_linux64.zip?generation=1575588386931675&alt=media – Stéphane GRILLON May 25 '20 at 13:42
  • I try download https://www.googleapis.com/download/storage/v1/b/chromium-browser-snapshots/o/Linux_x64%2F722276%2Fchrome-linux.zip?alt=media + unzip in `/usr/bin/google-chrome` + `export CHROME_BIN=/usr/bin/google-chrome/chrome` but do not work. if you find any sample, I will be happy :) – Stéphane GRILLON May 26 '20 at 16:12