Selenium and web driver setup for ubuntu
In this article, I am going to explain selenium and web driver setup for ubuntu.
Selenium Installation
Using the command below you can install the stable version of selenium.
pip install selenium
Chrome Installation
If you don’t already have chrome on your Ubuntu, then use the following commands
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
echo 'deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main' | sudo tee /etc/apt/sources.list.d/google-chrome.list
sudo apt-get update
sudo apt-get install google-chrome-stable
The above commands should install Chrome. (If you don’t already have it.)
Chrome Driver Installation
WebDriver is an open-source tool for automated testing of web apps across many browsers. It provides capabilities for navigating to web pages, user input, JavaScript execution, and more.
You can get the chrome driver link for the corresponding chrome version here.
Use the following commands to install the chrome driver.
wget -N http://chromedriver.storage.googleapis.com/2.26/chromedriver_linux64.zip
Instead of http://chromedriver.storage.googleapis.com/2.26/chromedriver_linux64.zip, use the correct version of the chrome driver link which matches your chrome version.
Use the following command to unzip the zip file which you downloaded above and to change the access permissions of file system objects.
unzip chromedriver_linux64.zip
chmod +x chromedriver
With the commands above you can easily install a chrome drive in your system.
Now, we need to put the chrome driver in the proper location, so that any time we call it from our python code, python knows where to find it.
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
Successfully we’ve installed selenium, chrome driver and chrome(if needed) in our system.
Thanks for reading!!