Selenium grid
Selenium–Grid allows you 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 support distributed test execution.Distributed Architecture
We will try to understand how the selenium grid architecture looks like and a model is shown below Selenium Grid basically has a setup of- Server (Also known as Hub)
- Client (Also known as Node)
Selenium server as Hub
Selenium server can be turned in to a node or a hub and the simple command to do it isjava -jar selenium-server-standalone-2.46.0.jar –role
Selenium server as Node
To make selenium server act as node, we first need to have- Address of the hub(including port number)
- Need to assign the role
java -jar selenium-server-standalone-2.46.0.jar -role webdriver -hub http://10.101.16.225:4444/grid/register -port 5557
Desired capabilities
Desired Capabilities are used to set some properties for webdriver, since not all server implementation will every webdriver feature supports !! Couple of the desired capabilities we need to set in Selenium Grid setup for webdriver client code are- Platform
- BrowserName
public class StarterofGrid { // RemotewebDriver instance public static RemoteWebDriver driver; public static void main(String[] args) throws MalformedURLException { DesiredCapabilities cap = null; cap = new DesiredCapabilities().firefox(); cap.setBrowserName("firefox"); cap.setPlatform(Platform.WIN8_1); driver = new RemoteWebDriver(new URL(remoteurl), cap); driver.navigate().to("http://www.google.com"); driver.findElementByName("q").sendKeys("execute automation"); driver.findElementByName("btnG").click(); }Thanks for reading the post and watching the video !!! Please leave your comments and let me know if there is anything I should update in this post. Thanks, Karthik KK
Hi Karthik,
Greatly impressed and gained much knowledge by all your videos! I’m an Automation QA, doing along BDD Specflow. I would like to run my tests using Selenium Grid in parallel. I did watched all your JAVA videos, still wondering is there any links or blogs executing Selenium Grid in C#.
Thanks in advance!