> For the complete documentation index, see [llms.txt](https://gyansetu-selenium.gitbook.io/selenium-testing/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://gyansetu-selenium.gitbook.io/selenium-testing/selenium-grid.md).

# Selenium Grid

Selenium Grid is a part of the Selenium Suite that specializes on running multiple tests across different browsers, operating systems, and machines in parallel.

#### When to Use Selenium Grid

&#x20;Run your tests against different browsers, operating systems, and machines all at the same time Save time in the execution of your test suites

#### &#x20;The Hub

* &#x20;The hub is the central point where you load your tests into.
* &#x20; There should only be one hub in a grid.&#x20;
* &#x20;The hub is launched only on a single machine, say, a computer whose O.S is Windows 7 and whose browser is IE.&#x20;
* &#x20;The machine containing the hub is where the tests will be run, but you will see the browser being automated on the node.&#x20;

#### The Nodes

* &#x20; Nodes are the Selenium instances that will execute the tests that you loaded on the hub.&#x20;
* &#x20;There can be one or more nodes in a grid.&#x20;
* &#x20;Nodes can be launched on multiple machines with different platforms and browsers.&#x20;
* &#x20;The machines running the nodes need not be the same platform as that of the hub.

&#x20;**How to Configure and Use Grid** Download the selenium-server-standalone jar file -In Hub\
&#x20;On the command prompt, type java -jar selenium-server-standalone-2.48.2.jar -role hub The hub should successfully be launched -\
In Node Register Node java -jar selenium-server-standalone-2.48.2.jar -role webdriver -hub http\:// 192.168.1.30:4444/grid/register

![](https://106491783-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LTW0eWU2biq082hmKEn%2F-LTkjOch6dRWngSbzMyd%2F-LTknQUpa7pQekoxdM6b%2Fimage.png?alt=media\&token=054908fe-f3e7-48d9-aa02-e56192aea258)

#### &#x20;Designing Test Scripts'

&#x20;To design test scripts that will run on the grid, we need to use DesiredCapabilites and the RemoteWebDriver objects.

* &#x20;DesiredCapabilites is used to set the type of browser and OS that we will automate
* &#x20; RemoteWebDriver is used to set which node (or machine) that our test will run against.\
  &#x20;Go to the Grid's web interface and hover on an image of the browser that you want to automate. Take note of the platform and the browserName

![](https://106491783-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LTW0eWU2biq082hmKEn%2F-LTkjOch6dRWngSbzMyd%2F-LTknf5nI4h6olwrJM1a%2Fimage.png?alt=media\&token=085c57ed-7095-4c95-bca7-259fd88243c4)

![](https://106491783-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LTW0eWU2biq082hmKEn%2F-LTkjOch6dRWngSbzMyd%2F-LTknmPsp7CdbXN2KOZM%2Fimage.png?alt=media\&token=12db46be-7060-4db9-b105-e1b6024bca44)

![](https://106491783-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LTW0eWU2biq082hmKEn%2F-LTkjOch6dRWngSbzMyd%2F-LTkns6W3wVdFJtv6nEf%2Fimage.png?alt=media\&token=1be8d1ac-99a9-4e90-b7cc-1fcf9d51cd27)
