Install java jar:

1. Add the PPA.

Open terminal (Ctrl+Alt+T) and run the command:

sudo add-apt-repository ppa:webupd8team/java

Type in your password when it asks and hit Enter.

2. Update and install the installer script:

Run commands to update system package index and install Java installer script:

sudo apt update; sudo apt install oracle-java8-installer

You may replace oracle-java8-installer with oracle-java9-installer to install Java 9.

While the install process, you have to accept Java license to continue downloading & installing Java binaries.

3. Check the Java version

To check the Java version after installing the package, run command:

javac -version

4. Set Java environment variables

The PPA also contains a package to automatically set Java environment variables, just run command:

sudo apt install oracle-java8-set-default

For Java 9, install the package oracle-java9-set-default instead.

Setup Selenium Standalone Server

 1. Download Selenium Selenium Standalone Server:

Go to and then download Selenium Standalone Server by clicking ‘Download version 3.0.1‘ (version number may vary).

You need to download this for both hub and node PCs

2. Now, start the Hub machine:

Open the terminal, CD to the location where the selenium standalone server file is being kept and type:

java -jar selenium-server-standalone-2.30.0.jar -role hub

It will start the hub.

Another way to verify whether the hub is running is by using a browser. Selenium Grid, by default, uses hub’s port 4444 for its web interface. Simply open up a browser and go to http://localhost:4444/grid/console

Also, you can find if the node can access the hub. For this, open a browser in the node machine and type as URL. Here ‘’ should replace with the node machine’s IP address.

3. Now, the hub is up and running. Let’s setup node:

In the node machine, open a terminal, CD to the location where the selenium standalone jar file is located and type the following command:

java -jar selenium-server-standalone-3.0.1.jar -role webdriver -hub -port 5566

Here, should be replaced with the hub machine’s IP address.

We also used port 5566 though you may choose any free port number you desire.

If everything went well, the node will up and show it’s status.

You can also verify if the node is connected with hub properly from the web browser.

Refresh the URL and it will show the connected nodes.

4. Run the selenium script:

Now, we will run a selenium remote control script from the hub machine and it will execute to the node machines.

Here is a sample python script we are using:

Please Note: To run this script the node pc must have installed the following things:

  1. Python
  2. Python PIP
  3. Selenium
  4. Latest Chrome driver

Remote Control Script:

# -*- coding: utf-8 -*-
from selenium import selenium
import unittest, time, re

class sample-script(unittest.TestCase):
 def setUp(self):
 self.verificationErrors = []
 self.selenium = selenium("localhost", 4444, "*chrome", "")
 def test_sample-script(self):
 sel = self.selenium"/")
 sel.type("id=edit-search-block-form--4", "test")"xpath=.//*[@value='Search']")
 for i in range(60):
 if sel.is_element_present("xpath=.//*[@id='block-system-main']/div/h2"): break
 except: pass
 else:"time out")
 try: self.failUnless(sel.is_element_present("xpath=.//*[@id='block-system-main']/div/h2"))
 except AssertionError as e: self.verificationErrors.append(str(e))
 def tearDown(self):
 self.assertEqual([], self.verificationErrors)

if __name__ == "__main__":

To verify if the above listed items are already been installed, run this script from the terminal. If the following scripts run properly then everything is installed and ready.

Sample Script:

# -*- coding: utf-8 -*-
from selenium import webdriver
from import By
from selenium.webdriver.common.keys import Keys
from import Select
from selenium.common.exceptions import NoSuchElementException
from selenium.common.exceptions import NoAlertPresentException
import unittest, time, re

class SampleWebScriptPy(unittest.TestCase):
 def setUp(self):
 self.driver = webdriver.Chrome()
 self.base_url = ""
 self.verificationErrors = []
 self.accept_next_alert = True
 def test_sample_web_script_py(self):
 driver = self.driver
 driver.get(self.base_url + "/")
 for i in range(60):
 if self.is_element_present(By.XPATH, ".//*[@id='block-system-main']/div/h2"): break
 except: pass
 else:"time out")
 try: self.assertTrue(self.is_element_present(By.XPATH, ".//*[@id='block-system-main']/div/h2"))
 except AssertionError as e: self.verificationErrors.append(str(e))
 def is_element_present(self, how, what):
 try: self.driver.find_element(by=how, value=what)
 except NoSuchElementException as e: return False
 return True
 def is_alert_present(self):
 try: self.driver.switch_to_alert()
 except NoAlertPresentException as e: return False
 return True
 def close_alert_and_get_its_text(self):
 alert = self.driver.switch_to_alert()
 alert_text = alert.text
 if self.accept_next_alert:
 return alert_text
 finally: self.accept_next_alert = True
 def tearDown(self):
 self.assertEqual([], self.verificationErrors)

if __name__ == "__main__":

Good luck!