Monday, 18 April 2016

Selenium Grid ( Simple )

Selenium Grid distributes our tests across multiple machines so that we can run them in parallel, cutting down the time required for running tests.

The selenium-server-standalone package includes the Hub, WebDriver, and Selenium RC needed to run the grid.

Setting up Hub: (Simple)
java -jar selenium-server-standalone-2.53.0.jar -port 4444 -role hub

Setting up Node:(Simple)
java -jar selenium-server-standalone-2.53.0.jar -role webdriver -hub http://xx.xx.xx.xx:4444/grid/register –port 8989 -Dwebdriver.chrome.driver=path/to/chromedriver.exe


Selenium Remote WebDriver code:

DesiredCapabilities cap = new DesiredCapabilities(); 
                                cap.setBrowserName("firefox");
                                cap.setPlatform(org.openqa.selenium.Platform.WINDOWS);


WebDriver driver = new RemoteWebDriver(new URL("http://xx.xx.xx.xx:4444/wd/hub"),cap);


Thats all.

No comments:

Post a Comment