Webdriver | Selenium Grid | Remote Driver

Selenium- Grid allows you to run your tests on different machines against different browsers in parallel. That is, running multiple tests at the same time against different machines running different browsers and operating systems. Essentially, Selenium-Grid supports distributed test execution. It allows for running your tests in a distributed test execution environment. To learn more about the grid click here.

We must start a hub and register  nodes on it to trigger executions:

Use the following command-line code to start a hub

java -jar selenium-server-standalone-3.11.0.jar -role hub

Use the following command-line code to register a node

java -jar selenium-server-standalone-3.11.0.jar -role node -hub http://192.168.2.1:4444/grid/register/ (Sample)

Remote driver for Chrome

1
2
3
4
5
6
7
8
9
10
11
'Directing the driver to use remote options for chrome
 Call wd.UseChrome_RemoteOptions()
 
'Adding some remote options
 Call wd.BrowserVersion_RemoteOptions("79.0.3945.88")
 
'Launch remote driver
 Call wd.InitializeRemoteDriver("http://192.168.50.1:4444/wd/hub")
 
'Navigating to the URL
 Call wd.NavigateToUrl("http://www.google.com")

Remote driver for IE

1
2
3
Call wd.UseInternetExplorer_RemoteOptions()
Call wd.InitializeRemoteDriver("http://192.168.50.1:4444/wd/hub")
Call wd.NavigateToUrl("http://www.google.com")

Remote driver for Firefox

1
2
3
Call wd.UseFirefox_RemoteOptions()
Call wd.InitializeRemoteDriver("http://192.168.50.1:4444/wd/hub")
Call wd.NavigateToUrl("http://www.google.com")

Similarly, it can be coded for other remote drivers like Safari, Android, iOS, etc.

Add a Comment

Your email address will not be published. Required fields are marked *