Read This: Setup Selenium with Firefox on Ubuntu

Step 1 – Prerequisites

Execute the following commands to install the required packages on your system. Here Xvfb (X virtual framebuffer) is an in-memory display server for a UNIX-like operating system (e.g., Linux). It implements the X11 display server protocol without any display. This is helpful for CLI applications like CI services. Also, install Java on your system. Let’s install Oracle Java 8 on your system or use the below command to install OpenJDK.

Step 2 – Install Google Chrome

Now install Latest Google chrome package on your system using the below list commands. Google chrome headless feature opens multipe doors for the automation.

Step 3 – Installing ChromeDriver

You are also required to set up ChromeDriver on your system. ChromeDriver is a standalone server that implements WebDriver’s wire protocol for Chromium. The WebDriver is an open-source tool for the automated testing of web apps across multiple browsers. Find out the Google chrome version installed on your system. Next, visit the Chromedriver download page and download the matching version of chromedriver on your system. In my case, Google Chrome 94 is running on my system. So download the following file. You must make sure to download the correct version of a file: You can find the latest ChromeDriver on its official download page. Now execute below commands to configure ChromeDriver on your system.

Step 4 – Download Required Jar Files

The Selenium Server is required to run Remote Selenium WebDrivers. You need to download the Selenium standalone server jar file using the below commands or visit here to find the latest version of Jar file. Also, download the testng-6.8.7.jar file to your system.

Step 5 – Start Chrome via Selenium Server

Your server setup is ready. Start Chrome via a standalone selenium server using the Xvfb utility. Run Chrome via Selenium Server Use -debug option at end of the command to start the server in debug mode. You can also Start Headless ChromeDriver by typing the below command on the terminal. Your Selenium server is now running with Chrome. Use this server to run your test cases written in Selenium using the Google Chrome web browser. The next step is an optional step and doesn’t depend on Step 5.

Step 6 – Sample Java Program (Optional)

This is an optional step. It describes running a single test case using a Selenium standalone server and ChromeDriver. Let’s create a Java program using the Selenium server and Chrome Driver. This Java program will open a specified website URL and check if a defined string is present on the webpage or not. Create a Java program by editing a file in a text editor. Add the below content to the file.

You can change the URL “” with any other URL of your choice, Then also change the search string like “I’m Feeling Lucky” used in the above Java program. Save your java program and execute it. First, you need to set the Java CLASSPATH environment variable including the selenium-server-standalone.jar and testng-6.8.7.jar. Then compile the java program and run it. You will see the results below. If the defined search string is found, You will get the message “Pass” and if the string is not found on the webpage, you will get the “Fail” message on the screen.

How to Setup Selenium with ChromeDriver on Ubuntu 22 04  20 04   18 04   TecAdmin - 27