More Log in Sign up
Pages / … / Selenium Issues
Selenium Grid Server Configuration HUB & Node Setup for Chrome, Firefox,
Safari & IE
Last updated: Mar 07, 2018 12:56
By Raj Pasupathy
Selenium grid lets you tests your scripts on different desktop browsers in parallel.
Selenium Grid Server Configuration Setup
Selenium grid lets you tests your scripts on different desktop browsers in parallel.
Download the latest required Selenium Server Standalone jar: [Link]
Download the latest Firefox/Chrome/IE & Safari Drivers: [Link]
/* Selenium HUB */
The hub is the main console that all the nodes will be connecting too. Therefore onces the HUB is started, firefox, IE & Chrome nodes can be connected
to the main hub. See below diagram to start the selenium Admin Hub. Note: Please run cmd as an administrator.
/* Specific Port Assign */
java -jar [Link] -port XXXX -role hub
/* Default Port 4444 */
java -jar [Link] -role hub
Starting Hub Node
Admin Console View
Shows the users of all the running nodes against the HUB. Initially there will be no firefox, IE or chrome nodes listed on the admin console view. See
sections below on how to start these nodes appropriately.
Console View URL: [Link]
Admin Console View
Shows all browser nodes attached to the Hub.
Connecting all Nodes to the HUB
Once the Admin hub is setup successfully, we can setup the individual nodes for IE, Chrome, Firefox & Safari respectively. My recommendation would be
to setup each browser node independently. The reason being is that if one node goes down, it doesn’t bring the other node’s down. Note: the below hub
starts a maximum instance of 10 browsers each. Please set the appropriate instance based on your hardware.
Setup all drivers with a single Node
A way to setup a single node connecting to a HUB.
IE, Chrome, Safari & firefox selenium NODE
java -[Link]=C:/eclipse/IEDriverServer/[Link] -[Link]=C:/eclipse/chromedriver/[Link] -jar
[Link] -port 5555 -role node -hub [Link] -browser "browserName=firefox, maxInstances=10,
platform=ANY, seleniumProtocol=WebDriver" -browser "browserName=internet explorer, version=11, platform=WINDOWS, maxInstances=10" -browser
"browserName=chrome,version=ANY,maxInstances=10,platform=WINDOWS"
IE Node Setup
java -[Link]=C:/eclipse/IEDriverServer/[Link] -jar [Link] -port 5555 -role node -
hub [Link] -browser "browserName=internet explorer,version=11,platform=WINDOWS,maxInstances=10"
Chrome Node Setup
java -[Link]=C:/eclipse/chromedriver/[Link] -jar [Link] -port 5556 -role node -
hub [Link] -browser "browserName=chrome, version=ANY, maxInstances=10, platform=WINDOWS"
FireFox Node Setup
java -jar [Link] -port 5557 -role node -hub [Link] -browser "browserName=firefox,
maxInstances=10, platform=ANY, seleniumProtocol=WebDriver"
All node Setup
Selenium Grid Server Code Access
The below java code snippet shows how to connect to all the nodes as all you need to do is provide the ip address of the VM where the node are
configured.
String ipAddress = "[Link]";
/* Firefox */
driver = new RemoteWebDriver(new URL("[Link] capability);
/* Chrome */
driver = new RemoteWebDriver(new URL("[Link] capability);
/* IE */
driver = new RemoteWebDriver(new URL("[Link] capability);
/* Code Snippet */
try {
if ([Link]().getParameter("browser").equals("firefox")) {
DesiredCapabilities capability = [Link]();
driver = new RemoteWebDriver(new URL("[Link] capability);
[Link]().timeouts().pageLoadTimeout(30, [Link]);
[Link]().timeouts().implicitlyWait(30, [Link]);
} else if ([Link]().getParameter("browser").equals("chrome")){
DesiredCapabilities capability = [Link]();
driver = new RemoteWebDriver(new URL("[Link] capability);
[Link]().timeouts().pageLoadTimeout(30, [Link]);
[Link]().timeouts().implicitlyWait(30, [Link]);
} else if ([Link]().getParameter("browser").equals("IE")) {
DesiredCapabilities capability = [Link]();
driver = new RemoteWebDriver(new URL("[Link] capability);
[Link]().timeouts().pageLoadTimeout(30, [Link]);
[Link]().timeouts().implicitlyWait(30, [Link]);
} else {
[Link]("Not able to set Driver object");
}
} catch (Exception e) {
[Link]();
}
Powered by Atlassian Confluence 6.6.2 ·