Ruby code example using Selenium Grid

This Ruby code example will get you a quick start using a selenium grid to run a single test

Install the latest selenium client version equivalent to your selected selenium grid version. Example: If you selected to use selenium version 3.14.0 for your selenium grid, install the latest 3.14.x for Ruby.

gem install selenium-webdriver -v 3.14.0
Note: starting from selenium version 3.9.1 you must also include "platformName": "windows" in the request when testing with firefox and IE.

gem 'selenium-webdriver', '= 3.14.0'
require 'selenium-webdriver'

# If the requested test environment is not registered with the hub
# or busy, allow enough time for the Gridlastic auto scaling
# functionality to launch a node with the requested environment.
client =
client.timeout = 600 # seconds.  

caps =
:version               => "latest",
:platform              => "WIN10",
:platformName          => "windows",
:video                 => "True"
driver = Selenium::WebDriver.for(:remote, :url => "", :http_client => client, :desired_capabilities => caps)
driver.manage.timeouts.implicit_wait = 60 # seconds
driver.manage.window.maximize # If Linux always set window size like driver.manage.window.size =, 1080)

#print 'Video: ' + VIDEO_URL + driver.capabilities['webdriver.remote.sessionid']
print 'Video: ' + VIDEO_URL + driver.session_id  # If using chrome 75+ ""
element = driver.find_element(:name, 'q')
element.send_keys "Hello WebDriver!"

The Gridlastic hub endpoint and the video url used in this code example is displayed after launching your Gridlastic selenium grid. See documention Selenium Grid Configuration Parameters where to find these credentials and replace with your own.

Ruby Selenium Proxy Example

Use a selenium proxy to route your tests via our hosted Squid proxy or use your own proxy locally to test behind firewall internal sites using Gridlastic Connect Proxy Setup.

PROXY = ""; # hosted Squid proxy on your selenium grid hub
#PROXY = ""; # An example Gridlastic Connect endpoint

proxy =
  :http     => PROXY,
  :ftp      => PROXY,
  :ssl      => PROXY

caps = => proxy)

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.
It is important to ensure that "driver.quit" is always called for proper test execution and creation of video recordings of failed tests.