• Uncategorized

About linux : Determine-if-Chrome-is-installed-on-a-Linux-VM

Question Detail

I am setting up a CI/CD pipeline for an Angular application. Part of this pipeline will run some end-to-end/UI tests, using Protractor and Chrome. The pipeline script is written using Groovy, and the CI/CD software is Jenkins.

Currently, the VM doesn’t have Chrome or ChromeDriver installed, and I can’t access it over ssh. Further, I’m not entirely sure if the VM is always the same, each time the pipeline is run. So I think the best way to make sure Chrome is installed is to check at the top of the Groovy script, and if it’s not, then to install it. I’ve found these instructions for installing Chrome on a Linux VM:

sudo apt-get install libxss1 libappindicator1 libindicator7
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb

sudo dpkg -i google-chrome*.deb
sudo apt-get install -f
sudo apt-get install xvfb
sudo apt-get install unzip

wget -N http://chromedriver.storage.googleapis.com/2.20/chromedriver_linux64.zip
unzip chromedriver_linux64.zip
chmod +x chromedriver

sudo mv -f chromedriver /usr/local/share/chromedriver
sudo ln -s /usr/local/share/chromedriver /usr/local/bin/chromedriver
sudo ln -s /usr/local/share/chromedriver /usr/bin/chromedriver
sudo apt-get install python-pip


But I don’t want to have run this every time, as it’s likely that Chrome will already be installed. So how would I check in the Groovy script and then only run it if necessary? I’m pretty inexperienced with this stuff (I’m a front-end dev) so if I’ve made any mistakes or there are better ways to do this, please let me know!

EDIT: would a better way be to install ChromeDriver with npm? Should ChromeDriver be included in the package.json devDependencies?

Question Answer

No answer for now.

You may also like...

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.