Skip to main content

Setting up Selenium Grid on Mac OS

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

Submitted by tgoswami on August 31, 2020

Tarun has 11+ years of experience in Quality Assurance in different domains like Banking, E-commerce, Health and Education.

About

At ProgramsBuzz, you can learn, share and grow with millions of techie around the world from different domain like Data Science, Software Development, QA and Digital Marketing. You can ask doubt and get the answer for your queries from our experts.