1. Ready for hub&node:
Download Selenium-server include:
Browser driver: such as IEDriverServer.exe, geckodriver.exe, chromedriver.exe
Selenium: selenium-server-standalone-2.45.0.jar
JDK: such as jdk-8u77-windows-x64.exe
Maven: apache-maven-3.3.9
a. Install JDK
b. Add Java Home, Name: AVA_HOME value: C:\Program Files\Java\jdk1.8.0_77
c. Add jdk path to Java_home: such as: C:\Program Files\Java\jdk1.8.0_77\bin
d. add maven/bin to class pat, such as: D:\apache-maven-3.3.9\bin\
3. Update browser setting to allow pop-up window
4. Register Hub&Node(Set up as Bat is better)
Hub: java -jar selenium-server-standalone-3.0.1.jar -role hub -port 4444\
Node:java -jar selenium-server-standalone-3.0.1.jar -role node -hub http://127.0.0.1:4444/grid/register -port 5501 -maxSession 10 -browser "browserName=chrome,platform=WINDOWS,maxInstances=5"
5. check confirg
Selenium grid help:
Code.google.com/p/selenium/wiki/Grid2
6. Do update on Automation Code:
For example: Selenium + Java + TestNG
1) Set upda remote driver:
public static void setupChrome() {
System.setProperty("webdriver.chrome.driver",
"D:/Automation/Selenium tools/chromedriver_win32/chromedriver.exe");
driver.set(new ChromeDriver());
driver.get().manage().window().maximize();
}
2) Set up Parameters and set up browser
@Parameters({"browser", "url"})
if (browser.equalsIgnoreCase("ie")) {
Browser.setupRemoteInternetExplorer(url);
} else if (browser.equalsIgnoreCase("ff")) {
Browser.setupRemoteFireFox(url);
} else if (browser.equalsIgnoreCase("chrome")) {
Browser.setupRemoteChrome(url);
} else {
log.error("Browser not support: " + browser);
}
3) Use it on test suite
<suite name="TT_Staging" parallel="tests" thread-count="10">
<parameter name="url" value="http://127.0.0.1:4444" />
<parameter name="browser" value="chrome" />
7. Run case in sluser
1) Right clcik on suite: Run as TestNG suite
2) On hub use maven to run it
a. Down load the project
b. Under cmd: direct to project
c. Run: mvn test -Dfile=test.xml
Note: when runningsuite in maven, the suite is run in sequences.