In this tutorial, we will learn the steps involved to Run Selenium Grid in the background on Linux QA lab machines.
When we run the Selenium Grid in the foreground you should be running the terminal window for the grid to be running. A simple Ctrl + C key command can stop the grid and hamper the entire testing process.
$ java -jar <selenium_jar> standalone
If we close the terminal the Selenium Grid would stop along with it. In the next section, we will see the steps to overcome this issue especially on QA lab machines where the Grid is intended to run without disturbances from the users.
Run Selenium Grid in Background
To overcome these issues, we can run the Selenium Grid in the background with nohup command. Linux nohup command:
Launch the terminal and issue the following command
$ nohup java -jar <selenium_jar> standalone & > nohup.out
Note that we are running the grid in the standalone mode. This mode the server emulates all the components itself.( event bus, hub, nodes, router, distributer, sessions, sessionmap). In distributed mode we can invoke each component in the background as well.
This command would make the Grid to run in the background. To see the running grid logs, we can use:
$ tail -f nohup.out
In this example, we are redirecting the output to default nohup.out file. However, we can redirect to any file. For example, we can redirect the output to seleniumGrid.log file.
How to check the process?
We can use the ps utility to check the pid of the Selenium server process. Something like below command should work:
To kill the process we can use the following command:
$ kill -s KILL <pid>
Selenium Tutorials on this website:
Official Selenium Website: