- Documentation
- Quick Start Guide
- Selenium Grid Configuration
- Auto Scaling
- Spot Instance Nodes
- Selenium Grid Integration
- Pre Launch API Integration
- Selenium V4 Grid Code Examples
- Selenium V2/V3 Grid Code Examples
- Performance Testing
Robot Framework selenium grid example
This Robot Framework code example will get you a quick start using a selenium grid to run a single test. These code examples uses a Gridlastic selenium grid V3 for browser execution, see V4 examples.
The Gridlastic hub endpoint, video url and credentials used in this code example is displayed after launching your Gridlastic selenium grid.
Test Script
selenium_grid_example.robot
*** Settings *** Library SeleniumLibrary Library output_video_url.py *** Variables *** @{_tmp} ... browserName: chrome, ... platform: WIN10, ... platformName: windows, ... version: latest, ... username: USERNAME, ... accessKey: ACCESSKEY, ... video: True ${browser} Chrome ${capabilities} ${EMPTY.join(${_tmp})} ${remote_url} https://SUBDOMAIN.gridlastic.com/wd/hub *** Keywords *** Open Test Page Open browser https://www.gridlastic.com/?demo browser=${browser} ... remote_url=${remote_url} ... desired_capabilities=${capabilities} Maximize Browser Window *** Test Cases *** Run Test Open Test Page output video url [Teardown] Close Browser
Output Video URL
output_video_url.py
from robot.libraries.BuiltIn import BuiltIn import time def output_video_url(): session_id = BuiltIn().get_library_instance('SeleniumLibrary').driver.session_id BuiltIn().log_to_console("VIDEO_URL=https://s3-us-west-1.amazonaws.com/........./play.html?"+session_id) time.sleep(15)
Run Test
robot selenium_grid_example.robot
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.
Try our
SELENIUM GRID DEMO