December 7, 2022

Run selenium cases in linux server using Chrome Browser

In this article we will see How to run selenium cases in linux server using Chrome Browser in Headless Mode.

Detailed Steps:

[root@localhost ~]# yum-config-manager --enable ol7_optional_latest

[root@localhost ~]# wget

[root@localhost ~]# yum -y install redhat-lsb libXScrnSaver

[root@localhost ~]# yum -y install google-chrome-stable_current_x86_64.rpm

 Install xvfb as root:

[root@localhost ~]# yum install xorg-x11-server-Xvfb

Start display:

[root@localhost ~]# Xvfb -ac :99 -screen 0 1280x1024x16 & export DISPLAY=:99

Test The Code:

ChromeOptions chromeOptions = new ChromeOptions();


System.setProperty("", "./src/test/resources/drivers/linux/chromedriver");

WebDriver driver = new ChromeDriver(chromeOptions);

driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);



1.If the driver is not executable: Copy chromedriver and give 777 permission

2.unknown error: cannot find Chrome binary - Install chrome browser

3.unknown error: Chrome failed to start: crashed. - Run in headless mode 

Written by Sushanth, personal technology columnist and founder of Logical Bee. You can follow him on the social web or sign up for the email newsletter for your daily dose of how-to guides and video tutorials.