Robot framework selenium grid example

Robot framework using Selenium2Library is supported by Gridlastic on your very own selenium grid in the cloud, run your tests at high speed on real browsers.

The Gridlastic hub endpoint and the video url used in this code example is displayed after launching your Gridlastic selenium grid (free).

Test Script


*** Settings ***
Documentation               Robot Framework Example
Metadata                    VERSION     1.0
Library                     Selenium2Library
Test Setup                  Start browser
Test Teardown               Close All Browsers

*** Variables ***
${BROWSER}                  internetexplorer
${ALIAS}                    None
${DESIRED_CAPABILITIES}     platform:WIN10,video:True,version:11

*** Keywords ***
Start Browser
    [Documentation]         Start browser on Selenium Grid
    Open Browser            ${URL}  ${BROWSER}  ${ALIAS}  ${REMOTE_URL}  ${DESIRED_CAPABILITIES}
    Maximize Browser Window

*** Test Cases ***
Test Google
    [Documentation]         Test Google
    output video url
    Input Text    q    webdriver
    Submit Form
    Wait Until Page Contains    Searches related to webdriver

Output Video URL

from robot.libraries.BuiltIn import BuiltIn

def output_video_url():
    session_id = BuiltIn().get_library_instance('Selenium2Library')._current_browser().session_id

Run Test

pybot test.txt

Get a free account and launch your Gridlastic selenium grid demo, then run this code locally and test your grid!

NOTE: Gridlastic auto scaling requires all 3 test environment parameters platform, browser and browser version to be specified in each request in order to launch test nodes to fulfill test demand. Video recording is optional. See test environments for capabilities options.