Image Courtesy: Boloji.com
Sometimes we might end up with the need to run our Selenium tests on a different machine. The reasons why we might want to do this could be many. Here are a few reasons :
Ok so enough of stories.. :) Here’s what you need to get a Selenium Grid up and running.
chromedriver- If you are going to be running tests on Chrome. Refer here to learn more.
geckodriver- If you are going to be running tests on Firefox. Refer here to learn more.
safaridriver- If you are going to be running tests on Safari. [ This now comes pre-bundled with
Sierra (v10.12.6)and above.
iedriverserver- If you are going to be running tests on Internet Explorer. Refer here to learn more.
edgedriver- If you are going to be running tests on Microsoft Edge browser. Refer here to learn more.
You don’t need all of the above. It depends on what platform you are going to be running your Grid setup and also depends upon what browser flavor you would like to run tests against. For e.g., if you dont have a OSX, then you pretty much cannot include Safari. If you have only Linux boxes at your disposal, then you don’t need either the
IEDriverServer (or) the
EdgeDriver because they are windows only binaries.
The driver binaries (
edgedriver) are what helps selenium interact with the actual browser. These binaries are now built and released by the respective browser manufacturers themselves because they know their browsers better than anyone else. Selenium relies on these binaries to talk to the actual browser.
In general there are two ways in which you can configure driver binaries.
By adding the directory wherein the driver binaries reside, as part of your
PATH variable. Depending on what platform you are trying to update your
PATH on, one of the below resources should be useful.
Informing the server binary location via a JVM argument.
The hub can be started via the command:
java -jar selenium-server-standalone-3.141.59.jar -role hub
This causes the
hub to be started and listen on port
The node can be started via the command :
java -jar selenium-server-standalone-3.141.59.jar -role node
This spins off a node with the following features :
5555(this is the default port)
Ever wondered how does information flow back and forth between your testcase and the Grid ? Ever wondered how all this fits in ?
When your test tries to talk the Grid here’s how the flow happens:
JSON Payloadin which the most important thing that gets captured is the browser flavor (This is applicable only when a new session request is created).
JSON Payloadis then forwarded to http://localhost:4444/wd/hub (For the sake of simplicity lets assume that our Hub is listening on port
Here’s a pictorial representation of how does your selenium instructions flow across all the systems.