Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
56 views14 pages

Selenium Grid: Parallel Execution Guide

The document provides a comprehensive guide on configuring and using Selenium Grid for parallel and sequential execution of test cases across multiple browsers. It includes instructions for starting a hub, registering nodes, setting up browser drivers, and executing tests both serially and in parallel. Additionally, it covers the setup of JSON configurations for hubs and nodes.

Uploaded by

anjali gaikwad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
56 views14 pages

Selenium Grid: Parallel Execution Guide

The document provides a comprehensive guide on configuring and using Selenium Grid for parallel and sequential execution of test cases across multiple browsers. It includes instructions for starting a hub, registering nodes, setting up browser drivers, and executing tests both serially and in parallel. Additionally, it covers the setup of JSON configurations for hubs and nodes.

Uploaded by

anjali gaikwad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

SELENIUM GRID

[Link]
PARALLEL/SEQUENTIAL EXECUTION

HUB 4444

500 Test
Cases
NODE 3 - 7777

NODE 1 5555 NODE 2 - 6666


200 Test
Cases
100 test
cases 200 test
cases
B - Firefox

B – IE, FF,
Chrome B - Chrome
How to configure hub and nodes

STARTING A HUB
java -jar [Link] –role hub
REGISTERING A NODE TO THE HUB
java -jar [Link] -role webdriver –hub
[Link] -port 5555

SETTING UP SUPPORTED BROWSER NAMES

java -jar [Link] -role webdriver -hub


[Link] -port 5555 -browser
browserName=firefox -browser browserName=iexplore -browser
browserName=chrome
SETTING UP MAX INSTANCES & SESSIONS

SETTING UP MAX INSTANCES


java -jar [Link] -role webdriver -hub
[Link] -port 5555 -browser browserName=firefox
-browser browserName=iexplore -browser browserName=chrome,maxInstances=3

SETTING UP MAX SESSIONS

java -jar [Link] -role webdrive


r -hub [Link] -port 5555 -browser browserName=firef
ox,maxInstances=4 -browser browserName=iexplore -browser
browserName=chrome,maxInstances=3 -maxSession 4
SETTING UP CHROME & IE DRIVERS

SETTING UP CHROME DRIVER


-[Link]= C:\Softwares\[Link]

SETTING UP IE DRIVER
-[Link]= C:\Softwares\[Link]

FINAL COMMAND
Java -[Link]= C:\Softwares\[Link]
-[Link]= C:\Softwares\[Link]
-jar [Link] -role webdriver
-hub [Link] -port 5555 -browser
browserName=firefox,maxInstances=4 -browser browserName=iexplore -browser
browserName=chrome,maxInstances=3 -maxSession 4
WHAT WE HAVE SEEN SO FAR:

✓What is Grid?
✓What are Hub and Nodes?
✓Grid Console
✓Configuring Hub & Nodes
✓What are Max Instances
✓Whar are Max Sessions
✓Setting up Max Instances & Sessions
✓Configuring Grid for IE & Chrome
driver support
✓Registering Multiple nodes to a hub
WHAT WE WILL SEE NOW:

✓How to execute single test on a


single node – serially on multiple
browsers?
✓How to execute single test on a
single node – Parallely on multiple
browsers?
Single test on a single node – serially on
multiple browsers

public class testSearch {

@Test(dataProvider="getData")
public void doSearch(String text, String browser)
throws MalformedURLException{

[Link](browser);
DesiredCapabilities capabilities = null;
if([Link]("firefox")){

capabilities = [Link]();
[Link]("firefox");
[Link]([Link]);
}else if([Link]("ie")){

capabilities = [Link]();
[Link]("iexplore");
[Link]([Link]);

}else if([Link]("chrome")){

capabilities = [Link]();
[Link]("chrome");

[Link]([Link]);
}
//require for WebDriver
RemoteWebDriver driver = new
RemoteWebDriver(new
URL("[Link] capabilities);
//RemoteWebDriver driver = new FirefoxDriver();
[Link]("[Link]
[Link]([Link]("q")).sendKeys(text);
}
@DataProvider
public Object[][] getData(){

Object[][] data = new Object[2][2];


data[0][0] = "selenium";
data[0][1] = "firefox";

data[1][0] = "selenium";
data[1][1] = "chrome";

return data;

}
Single test on a single node – Parallely on
multiple browsers

public class testSearch {

@Test(dataProvider="getData")
public void doSearch(String text, String browser)
throws MalformedURLException{

[Link](browser);
DesiredCapabilities capabilities = null;
if([Link]("firefox")){

capabilities = [Link]();
[Link]("firefox");
[Link]([Link]);
}else if([Link]("ie")){

capabilities = [Link]();
[Link]("iexplore");
[Link]([Link]);

}else if([Link]("chrome")){

capabilities = [Link]();
[Link]("chrome");

[Link]([Link]);
}
//require for WebDriver
RemoteWebDriver driver = new
RemoteWebDriver(new
URL("[Link] capabilities);
//RemoteWebDriver driver = new FirefoxDriver();
[Link]("[Link]
[Link]([Link]("q")).sendKeys(text);
}
@DataProvider (parallel=true)
public Object[][] getData(){

Object[][] data = new Object[2][2];


data[0][0] = "selenium";
data[0][1] = "firefox";

data[1][0] = "selenium";
data[1][1] = "chrome";

return data;

}
SETTING UP JSON FOR HUB & NODES

SETTING UP JSON FOR HUB


java -jar [Link] -role hub -hub Config [Link]

SETTING UP JSON FOR NODE


java -jar [Link] -role webdriver -nodeConfig [Link]

You might also like