How to Install Selenium Tools on Linux?
Selenium is an open-source umbrella project providing a collection of web browser automation technologies and libraries. Without having to learn a test scripting language, Selenium provides a playback tool for building functional tests. In this article, we will be learning how to install and setup Selenium with Chrome Webdriver in Linux.
Installing Selenium Tools on Linux
To install Selenium Tools on Linux follow the following steps:
Step 1: Install Java. Java must be installed on your computer. Install Oracle Java 8 or OpenJDK with the command below.
sudo apt install default-jdk
Step 2: Install Google Chrome. Using the commands shown below, install the most recent Google Chrome package on your PC.
sudo curl -sS -o – https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add
sudo bash -c “echo ‘deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main’ >> /etc/apt/sources.list.d/google-chrome.list”
sudo apt-get update
sudo apt-get install google-chrome-stable
Step 3: Install Chrome Webdriver. You must also install ChromeDriver on your computer. It is a standalone server for Chromium that is used to implement WebDriver wire protocol. It is an open-source tool for testing web applications. So to check the version of Google Chrome installed on your system write the following command in the terminal.
google-chrome –version
Next, go to the ChromeDriver download page and download chromedriver on your system.
weget https://chromedriver.storage.googleapis.com/99.0.4844.51/chromedriver_linux64.zip
unzip chromedriver_linux64.zip
Now execute the below commands to configure ChromeDriver on your system.
sudo mv chromedriver /usr/bin/chromedriver
sudo chown root:root /usr/bin/chromedriver
sudo chmod +x /usr/bin/chromedriver
Step 4: Download Required JAR files. To use Remote Selenium WebDrivers, you’ll need the Selenium Server. Use the following commands below to get the Selenium server jar file, or you can download the latest version from the official website.
we get https://github.com/SeleniumHQ/selenium/releases/download/selenium-4.1.0/selenium-server-4.1.2.jar
mv selenium-server-4.1.2.jar selenium-server.jar
Step 5: Start Chrome via Selenium Server. The server is set up and ready to go. Using the xvfb utility, we will start Chrome via the selenium server.
xvfb-run java -Dwebdriver.chrome.driver=/usr/bin/chromedriver -jar selenium-server.jar
You might need to first install xvfb which can be done using the following command.
sudo apt install xvfb
Now you are all set to use Selenium Tools.
Contact Us