Setup selenium grid to use in robotframework
Setup selenium grid to use in robotframework for web browser automation testing.
Prerequisites
- Download selenium-server-standalone-x.xx.x.jar
- Grid server (hub): java
- Grid client (node): java, robotframework, web browsers such as firefox, chrome, or ie
Start the hub
$ java -jar selenium-server-standalone-x.xx.x.jar -role hub
Register a node
$ java -jar selenium-server-standalone-x.xx.x.jar \
-role node \
-hub http://hub-server:4444/grid/register
Optional config
- -port XXXX (default 4444)
- -host
- -timeout (default 300, seconds before hub releases node if no requests)
- -maxSession (default 5, max number of browsers to run in parallel)
- -browser
- browserName={android, chrome, firefox, htmlunit, internet explorer, iphone, opera}
- version={browser version}
- firefox_binary={path to executable binary}
- chrome_binary={path to executable binary}
- maxInstances={maximum number of browsers of this type}
- platform={WINDOWS, LINUX, MAC}
- -registerCycle
- examples:
$ -browser browserName=firefox,version=3.6,maxInstances=5,platform=LINUX
$ -browser browserName=firefox,version=3.6,firefox_binary=/home/myhomedir/firefox36/firefox,maxInstances=3,platform=LINUX
$ -browser browserName=firefox,version=4,firefox_binary=/home/myhomedir/firefox4/firefox,maxInstances=4,platform=LINUX
$ -browser “browserName=firefox,version=3.6,firefox_binary=c:\Program Files\firefox ,maxInstances=3, platform=WINDOWS”
Check grid console with web browser
$ http://hub-server:4444/grid/console
Use in robotframework script
*** Settings ***
Documentation This is just an example
Metadata VERSION 1.0
Library Selenium2Library
Suite Setup Start Browser
Suite Teardown Close Browser
*** Variables ***
${SERVER} http://www.google.com
${BROWSER} firefox
*** Keywords ***
Start Browser
[Documentation] Start firefox browser on selenium grid
Open Browser ${SERVER} ${BROWSER} None http://hub-server:4444/wd/hub
*** Test Cases ***
Check page title
[Documentation] Check the page title
Title Should Be Google
References