Any way to install specific/older chrome browser version - google-chrome

I have a script in my automation tests (built using protractor(5.4.0) and runs on Headless Chrome in Circle CI using Docker) which installs currently the latest chrome browser for me:
apt-get update && apt-get -y install libxss1 libappindicator1 libindicator7
curl -L -o google-chrome.deb https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
dpkg -i ./google-chrome*.deb
apt-get install -yf
This script downloads me the latest chrome browser version available.
Is there any way to get older version of chrome.deb and install via curl as there are few things I suspect aren't running since chrome updated and I would like to test with a older version once.
I found few older browser versions to install on websites like slimjet, ubunutu but would like to know if I can get it via https://dl.google.com or if there is any better way to do this.

For deb package at Ubuntu - Chrome:
CHROME_VERSION=77.0.3865.120-1
wget --no-check-certificate https://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_${CHROME_VERSION}_amd64.deb
dpkg -i google-chrome-stable_${CHROME_VERSION}_amd64.deb || apt -y -f install
rm google-chrome-stable_${CHROME_VERSION}_amd64.deb;
For Chromium:
For more info about old Chromium, please refer to: https://github.com/Bugazelle/chromium-all-old-stable-versions
CHROMIUM_VERSION=77.0.3865.120
wget --no-check-certificate https://raw.githubusercontent.com/Bugazelle/chromium-all-old-stable-versions/master/chromium.stable.json
download=$(jq -r ".linux64.\"${CHROMIUM_VERSION}\".download_url" chromium.stable.json)
position=$(jq -r ".linux64.\"${CHROMIUM_VERSION}\".download_position" chromium.stable.json)
echo "download url is: ${download}"
echo "position is: ${position}"
wget --no-check-certificate -O chromium.zip ${download}

ENV CHROME_VERSION "99.0.4844.84-1"
RUN set -ex && \
apt-get update -qqy && \
wget --no-check-certificate https://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_${CHROME_VERSION}_amd64.deb && \
apt-get install -qqyf ./google-chrome-stable_${CHROME_VERSION}_amd64.deb && \
rm google-chrome-stable_${CHROME_VERSION}_amd64.deb

Related

Unable to run chromedp in docker

I had installed chromedp locally using this usual way:-
$ go get -u github.com/chromedp/chromedp. I am able to run it locally but when I deployed it to my stage environment, I got below error:-
exec: \"google-chrome\": executable file not found in $PATH
What changes do I need to make in my dockerfile?
Note: I have already tried adding below code in my Dockerfile as suggested in this answer, still doesn't work
RUN apk update && apk upgrade && apk add --no-cache bash git && apk add --no-cache chromium
# Installs latest Chromium package.
RUN echo #edge http://nl.alpinelinux.org/alpine/edge/community >> /etc/apk/repositories \
&& echo #edge http://nl.alpinelinux.org/alpine/edge/main >> /etc/apk/repositories \
&& apk add --no-cache \
harfbuzz#edge \
nss#edge \
freetype#edge \
ttf-freefont#edge \
&& rm -rf /var/cache/* \
&& mkdir /var/cache/apk
RUN go get github.com/mafredri/cdp
CMD chromium-browser --headless --disable-gpu --remote-debugging-port=9222 --disable-web-security --safebrowsing-disable-auto-update --disable-sync --disable-default-apps --hide-scrollbars --metrics-recording-only --mute-audio --no-first-run --no-sandbox```
It took me a while to figure out this problem originally, it's not just you.
When your installing chromedp on your local machine it's grabbing the package and building for that specific distro. When you run it inside docker you need to download a specific chromium build for the distro you are running inside docker. This is because deb is different than rpm is different than alpine and you need to have the right chromium.
Here is a copy of my docker file using a basic linux distro
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub |
apt-key add - \
&& echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >>
/etc/apt/sources.list.d/google.list
RUN apt-get update && apt-get -y install google-chrome-stable
RUN chrome &
WORKDIR /app/svc/worker
RUN go build -o main .
EXPOSE 6061
CMD ["./main"]
This version for Alpine might work https://pkgs.alpinelinux.org/packages?name=chromium&branch=v3.10. However, in my experience it is best not to go with a minimal distro because chrome might depend on features not included in alpine.

Robot Framework - Docker - Chromedriver

I'm trying to setup a container to test with RobotFramework on chrome.
But when I run my container I keep getting a WebDriverException.
I've searched but couldn't find any fix that actually works for me.
This is my Dockerfile
FROM python:3
RUN apt-get update -y
# Dependencies
RUN apt-get install -y \
apt-utils \
build-essential \
fonts-liberation \
gconf-service \
libappindicator1 \
libasound2 \
libcurl3 \
libffi-dev \
libgconf-2-4 \
libindicator7 \
libnspr4 \
libnss3 \
libpango1.0-0 \
libssl-dev \
libxss1 \
python-dev \
python-pip \
python-pyasn1 \
python-pyasn1-modules \
unzip \
wget \
xdg-utils \
xvfb \
libappindicator3-1 \
libatk-bridge2.0-0 \
libgtk-3-0 \
lsb-release
# Install Chrome for Selenium
RUN curl https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb -o /chrome.deb
RUN dpkg -i /chrome.deb || apt-get install -yf
RUN rm /chrome.deb
# Install chromedriver for Selenium
RUN curl https://chromedriver.storage.googleapis.com/2.42/chromedriver_linux64.zip -o /usr/local/bin/chromedriver
RUN unzip -o /usr/local/bin/chromedriver -d /usr/local/bin
RUN chmod +x /usr/local/bin/chromedriver
WORKDIR /home
COPY . .
RUN pip install -e .
CMD [ "pybot","./tests/test.robot" ]
This is the error I keep getting
WebDriverException: Message: unknown error: Chrome failed to start:
exited abnormally (unknown error: DevToolsActivePort file doesn't
exist) (The process started from chrome location
/usr/bin/google-chrome is no longer running, so ChromeDriver is
assuming that Chrome has crashed.) (Driver info:
chromedriver=2.42.591071
(0b695ff80972cc1a65a5cd643186d2ae582cd4ac),platform=Linux
4.15.0-34-generic x86_64)
My test.robot:
*** Settings ***
Library Selenium2Library
*** Variables ***
*** Test Cases ***
Connect
Open Browser https://google.es Chrome
I think I am missing something but, I just dont know what to do.
On my setup.py:
install_requires=[
'robotframework',
'robotframework-selenium2library',
'selenium'
]
I ran into this issue recently using a docker container and Amazon Linux running robot tests. I found that even though I added the required arguments within the robot framework test as in the example below chrome was crashing without even starting with the same message you received. I resolved the issue by updating the python settings in the options.py within the container.
I updated my docker container with the command below to set the options in the python selenium chrome WebDriver options.py file. In my case I'm using python version 3.7 - so you want to make sure that the path you use is correct.
RUN sed -i "s/self._arguments\ =\ \[\]/self._arguments\ =\ \['--no-sandbox',\ '--disable-dev-shm-usage'\]/" /usr/local/lib/python3.7/site-packages/selenium/webdriver/chrome/options.py
Example Robot - this is what I tried within robot framework that didn't fix the problem.
${chrome_options} = Evaluate sys.modules['selenium.webdriver'].ChromeOptions() sys, selenium.webdriver
Call Method ${chrome_options} add_argument headless
Call Method ${chrome_options} add_argument disable-gpu
Call Method ${chrome_options} add_argument no-sandbox
Call Method ${chrome_options} add_argument disable-dev-sim-usage ${options}= Call Method ${chrome_options} to_capabilities
${options}= Evaluate sys.modules['selenium.webdriver'].ChromeOptions() sys, selenium.webdriver
open browser about:blank ${BROWSER} desired_capabilities=${options}
I'm not sure if this will address your issue. You could try updating your file manually before updating your container to see if it helps. I spent a lot of time troubleshooting this. It would be great if the error was a bit more descriptive.
Good luck.
Please change modify permission , it's will work
from
RUN chmod +x /usr/local/bin/chromedriver
to
RUN chmod 777 /usr/local/bin/chromedriver
I had the same issue and the below code fixed it
*** Settings ***
Library Selenium2Library
*** Variables ***
${URL} https://www.google.com
${CHROMEDRIVER_PATH} /usr/local/bin/chromedriver
*** Keywords ***
Open Website
${chrome_options}= Evaluate sys.modules['selenium.webdriver'].ChromeOptions() sys, selenium.webdriver
Call Method ${chrome_options} add_argument --no-sandbox
Call Method ${chrome_options} add_argument --headless
Open Browser ${URl} chrome options=${chrome_options} executable_path=${CHROMEDRIVER_PATH}
*** Settings ***
Suite Setup Open Website
This is my Dockerfile have test with gitlab CI:
FROM python:3.9.6-buster
ADD ./requirements.txt /tmp/requirements.txt
RUN pip install -r /tmp/requirements.txt
RUN apt-get update && apt-get install -y xvfb wget unzip libnss3-tools
RUN echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list \
&& wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
RUN apt-get update && apt-get install -y google-chrome-stable
RUN wget -q https://chromedriver.storage.googleapis.com/91.0.4472.101/chromedriver_linux64.zip -O /tmp/chromedriver_linux64.zip \
&& unzip -qq /tmp/chromedriver_linux64.zip -d /usr/local/bin \
&& rm /tmp/chromedriver_linux64.zip \
&& chmod +x /usr/local/bin/chromedriver
You can get more information to run Robot Framework with docker:
https://github.com/dylanops/docker-robot-framework

installing chrome in docker file

I am trying to install google chrome in docker build with following standard way:
ARG CHROME_VERSION="google-chrome-stable"
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
&& echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list \
&& apt-get update -qqy \
&& apt-get -qqy install \
${CHROME_VERSION:-google-chrome-stable} \
&& rm /etc/apt/sources.list.d/google-chrome.list \
&& rm -rf /var/lib/apt/lists/* /var/cache/apt/*
But my proxy does not allow google.com so it fails. Is there other way to install google chrome in ubuntu? I don't want to host any file in network so if there is another source (e.g. github) where I can find debian packages for chrome then I can just get that and run that with dpkg. Or, any other idea?
Thanks a lot.
I found a mirror in my network. Replacing source with my mirror, job was done!

Cannot install Chrome on Ubuntu 16.04

Doenloaded the .deb package of Chrome from Google's site. The installation doesn't work when trying to install from the GUI. What's up with that?
Its very simple to install google chrome on ubuntu . Type the following commands in the terminal
Step 1 : Download the latest Google Chrome .deb package with wget:
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
Step 2 : Install the Google Chrome .deb package
sudo apt install ./google-chrome-stable_current_amd64.deb
Hope this helps!
Google Chrome requires some missing dependencies as can be seen when trying to install from the terminal using dpkg -i. Prior to installing Chrome, run:
sudo apt-get install libindicator7 libappindicator1
After that, Chrome installation works fine.
Update the packages first in Ubuntu by below command.
$ sudo apt-get update
Install Required Dependices for Google Chrome as shown below.
$ sudo apt-get install libnss3-1d libxss1 libgconf2-4 libappindicator1 libindicator7
Download the Google Chrome command using below command.
$ wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
still during installation if you get some error that some dependency is not installed run the below command and it will install all required dependencies.
$ sudo apt-get -f install
Now let's go ahead and install Google Chrome by below command.
$ sudo dpkg -i google-chrome-stable_current_amd64.deb
And its done....
To open it just run below command command
$ google-chrome
You can download the latest package of chrome here
Install the package by clicking on it, or via the terminal:
sudo dpkg -i google-chrome-stable_current_amd64.deb
If you have issues, you may have to run:
sudo apt-get -f install
sudo dpkg -i google-chrome-stable_current_amd64.deb
Alternatively you can use gdebi to install the .deb packages.
It's a lightweight application that is better at installing .deb packages, and is quicker as well. If there are dependencies, it notifies that as well.
To install it type this in the terminal:
sudo apt install gdebi
Once done you can right click on .deb file and select to open it with Gdeb
I face so many issue to install google chrome on Ubuntu 16.04.
finalyl, I successfully install google chrome on ubuntu by following commands:
Step 1: $sudo apt-get install gdebi
Step 2: wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
Step 3: In same directory where you have download package or give path in command
$sudo gdebi google-chrome-stable_current_amd64.deb
installed chrome successfully.
I had same issue. on running google-chrome from terminal, found that it need new version of NSS. Chrome 62 need NSS>=3.26. So installed libnss3.
$google-chrome
[6999:7036:1113/200616.549496:FATAL:nss_util.cc(632)] NSS_VersionCheck("3.26") failed. NSS >= 3.26 is required. Please upgrade to the latest NSS, and if you still get this error, contact your distribution maintainer.
Aborted (core dumped)
sudo apt-get install --reinstall libnss3
and it worked for me :)

How to configure PHP 7 - Apache with MySQL PDO driver in Debian Docker image?

I'm using official docker images for PHP 7 (7.0.3-Apache) and MySql (5.7.10).
Using docker-compose, created containers from images and linked both.
Copied php.ini from https://github.com/php/php-src/blob/php-7.0.3/php.ini-production, replaced dll extensions with so and placed that file in /usr/local/etc/php and enabled _pdo_mysql_ extension in it.
extension=php_pdo_mysql.so
phpinfo shows php.ini loaded but not pdo_mysql extension because it's not installed.
I googled and tried different extension names with apt-get install:
php-mysql, php7-mysql, php7.0-mysql, php7.0.3-mysql.
None of them works. Error says: E: Unable to locate package.
With php5-mysql, it's get installed but after restarting apache with command: docker kill --signal="USR1" <container-name>, extension doesn't show loaded in php.ini.
(Don't think it's much related to docker but I'm new to docker and trying with that now, so mentioning it here.)
Can anyone help to configure pdo_mysql extension with php7-Apache?
You need the Dotdeb repository in /etc/apt/sources.list on your docker image:
FROM php:7-apache
# Install pdo_mysql
RUN apt-get update \
&& echo 'deb http://packages.dotdeb.org jessie all' >> /etc/apt/sources.list \
&& echo 'deb-src http://packages.dotdeb.org jessie all' >> /etc/apt/sources.list \
&& apt-get install -y wget \
&& wget https://www.dotdeb.org/dotdeb.gpg \
&& apt-key add dotdeb.gpg \
&& apt-get update \
&& apt-get install -y php7.0-mysql \
&& docker-php-ext-install pdo_mysql