Setting up Selenium Grid on Mac OS

Profile picture for user devraj

To get started with Selenium Grid, it is essential to have Java already installed, and set up the environment variables. To set up Selenium Grid on Mac OS, follow below steps:

Step 1: Download the Selenium Server Standalone package from here. This package is a jar file, which includes the Hub, WebDriver and legacy RC that is needed to run the Grid. 

Step 2: Navigate to the directory where Selenium Server Standalone jar file is stored and Start the Hub using below command. Hub is the central point in the Selenium Grid that routes the JSON test commands to the nodes. It receives test requests from the client and routes it to the required nodes. 

$ java -jar selenium-server-standalone-3.141.59.jar -role hub -port 8888

I have started at port 8888. You can choose of your own. To view the status of the hub, open a browser window and navigate to https://localhost:8888/grid/console. Here replace localhost with address generated in terminal for Hub.

Step 3: Start Nodes, type below command, to start Chrome and Firefox on same address

$ java -jar selenium-server-standalone-3.141.59.jar -role node -hub http://192.168.1.74:8888/grid/register -browser browserName=chrome,version=80,webdriver.chrome.driver=/YourPath/chromedriver,maxInstances=5,platform=MAC -browser browserName=firefox,version=73,webdriver.gecko.driver=/YourPath/geckodriver,maxInstances=5,platform=MAC

Here note: 

  • We have specified selenium server jar again.
  • Role is node
  • Hub address generated earlier specified. note /grid/register here.
  • Each browser is separated by -browser
  • Each browser has different capabilities like browser name, version, path, max instances, platform

Above command will start chrome browser and firefox on same node. To start on separate node use:

$ java -jar selenium-server-standalone-3.141.59.jar -role node -hub http://192.168.1.74:8888/grid/register -browser browserName=chrome,version=80,webdriver.chrome.driver=/YourPath/chromedriver,maxInstances=5,platform=MAC 
$ java -jar selenium-server-standalone-3.141.59.jar -role node -hub http://192.168.1.74:8888/grid/register-browser browserName=firefox,version=73,webdriver.gecko.driver=/YourPath/geckodriver,maxInstances=5,platform=MAC