Site icon TestingDocs.com

Selenium Grid 2.0 Overview

Overview

Selenium Grid 2.0 allows us to run distributed tests on multiple machines that supports both the legacy Selenium RC and Webdriver.

Hub

Start the hub with default configuration. The Hub starts on the default port 4444.

\> java -jar selenium-server-standalone-<version>.jar -role hub

 

However, the Hub support many command line switches to change the behavior. For example, to start the Hub on non default port 7777, we can use the following command:

\>java -jar selenium-server-standalone-2.53.0.jar -role hub -port 7777

Node

Register a node with default configuration.

\> java -jar selenium-server-standalone-<version>.jar -role node

To register to the Hub that’s running on port 7777, we can use the following command:

\>java -jar selenium-server-standalone-2.53.0.jar -role node -hubPort 7777

Selenium Grid 2.0 Console

We can view the status of the Selenium Hub by opening a browser window and navigating to the following URL:

http://localhost:4444/grid/console

 

We can use the same selenium-server-standalone jar file to run the tests with both WebDriver and Selenium 1 Remote Control at the same time.

Selenium RC Tests

For Selenium RC tests we can use:

For default Configuration:

Selenium selenium = new DefaultSelenium(“localhost”, 4444, “*firefox”, “http://Application_under_test_URL”);

For the above example:

Selenium selenium = new DefaultSelenium(“localhost”, 7777, “*firefox”, “http://applicationURL.com”);

Webdriver Tests

WebDriver Tests in Selenium 2.x/3.x, we need to use the RemoteWebDriver and the DesiredCapabilities

DesiredCapabilities caps = DesiredCapabilities.firefox();

For default Configuration:

WebDriver driver = new RemoteWebDriver(new URL(“http://localhost:4444/wd/hub”), caps);

For the above example:

WebDriver driver = new RemoteWebDriver(new URL(“http://localhost:7777/wd/hub”), caps);

Selenium WebDriver Tutorials on this website can be found at:

https://www.testingdocs.com/selenium-webdriver-tutorial

For more details on the Selenium, visit the official website at:

https://www.selenium.dev/

Exit mobile version