Selenium grid on mac article describes how to install selenium grid on your MAC. I will also share a very basic test code to test the selenium grid on your MAC. Let’s start.

What is Selenium Grid?

Selenium Grid allows you to:

  • Scale by distributing tests on several machines ( parallel execution )
  • Manage multiple environments from a central point, making it easy to run the tests against a vast combination of browsers / OS.
  • Minimize the maintenance time for the grid by allowing you to implement custom hooks to leverage virtual infrastructure for instance.

Now, please go to http://www.seleniumhq.org/download/ and download Selenium Standalone Server.¬†Selenium team constantly updating the versions. You may see a different version, pls do not panic, just download it. ūüėČ

selenium-grid-on-mac

Then, create a seleniumgrid folder under Documents and copy the .jar file under the Documents > seleniumgrid folder as you see below.

selenium-grid-on-mac

What are Hub and Nodes?

Basically, we have a Hub which is a server that we connect from our tests and we have Nodes, they can be on different machines and they register with the hub. Simply, we have a hub and several nodes, nodes are registered our hub and hub knows that which browsers are available. Hub sends requests to the nodes based on desired capabilities and executes the tests.

How to Start and Configure Hub and Nodes on MAC

First, download the hub and node config files from below addresses.

Hub Config:

Node Config: 

Save them as hub.json and node.json under seleniumgrid folder.

How to start Selenium Grid on MAC?

Then save below script as startgrid.command this script automatically starts node and hub.

But before you need to install a chrome driver on your MAC. For this, please check this article.

Note: If you also download and move the firefox driver (geckodriver) to the /usr/local/bin folder, you can use below script. It registers both Firefox and Chrome drivers.

Then when you run below script both hub and node will be run.

./startgrid.command

selenium-grid-on-mac

Now, we can check the selenium grid is working on MAC. In order to do that, open a chrome browser and go to this link: http://localhost:4444/grid/console

You should see the below window which means grid works properly.

selenium-grid-on-mac

When you run below project it will run and it will use one of the chrome browsers of the grid.

GitHub Project for Basic Selenium Grid Test: https://github.com/swtestacademy/basicseleniumgridproject

Thanks.
Onur