Robot Framework selenium 4 grid example

This Robot Framework code example will get you a quick start using a selenium 4 grid to run a single test with video recording.

The remote url, video url and grid credentials used in this code example is displayed after launching your Gridlastic selenium grid.

This script requires a minimum version 6 of the SeleniumLibrary.

Test Script


*** Settings ***

Library  SeleniumLibrary

*** Variables ***


*** Keywords ***

Open Test Page
   &{GRIDLASTIC_OPTIONS}    Create Dictionary
    ...    video=true
    &{DESIRED_CAPABILITIES}    Create Dictionary
    ...    browserName=chrome
    ...    platformName=win10
    ...    browserVersion=latest
    ...    gridlastic:options=&{GRIDLASTIC_OPTIONS}
    Open Browser
    ...    remote_url=${remote_url}
    ...    desired_capabilities=${DESIRED_CAPABILITIES}
    Maximize Browser Window
    Sleep    10s

*** Test Cases ***

Run Test
    Open Test Page
    output video url
    [Teardown]  Close Browser	

Output Video URL

from robot.libraries.BuiltIn import BuiltIn
import time

def output_video_url():
    session_id = BuiltIn().get_library_instance('SeleniumLibrary').driver.session_id

Run Test

robot selenium_grid_example.robot