Getting Started - Selenium Remote Test

You can use the Testable platform as a remote Selenium grid. Each Selenium session will run on a Testable test runner according to the options you provide in your capabilities. This includes support for all Cloud providers, in your account or ours, as well as self-hosted test runners.

This guide provides a simple example to get you started using Selenium Java. This can easily adapted to other Selenium bindings. Read our Selenium remote testing guide for the full set of capabilities and commands we support.

Testable Cloud’s Selenium grid is accessible at:

https://selenium.testable.io/wd/hub

The API key for access is passed in your capabilities under testable:options or alternatively as a Basic authentication header (user:key format). API key for your account found after logging in under Org Management => API Keys.

Once you have your API key, you are ready to run your first test. Make sure you have your favorite Selenium bindings installed on your machine. This example uses Selenium Java (relies on API key coming the the TESTABLE_KEY environment variable):

import java.net.URL;

import org.openqa.selenium.MutableCapabilities;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.remote.RemoteWebDriver;

public class TestableExample {

  // read API key from TESTABLE_KEY env variable
  private static final String KEY = System.getenv("TESTABLE_KEY");

  public static void main(String[] args) throws Exception {
    MutableCapabilities testableOpts = new MutableCapabilities();
    // login to Testable, click the + on the left and select Remote Test to see all options
    testableOpts.setCapability("user", "remote");
    testableOpts.setCapability("key", KEY);
    testableOpts.setCapability("region", "aws-us-east-1");

    ChromeOptions options = new ChromeOptions();
    options.setCapability("browserName", "chrome");
    // browser version can be Latest, Beta, Latest-X for X versions ago, or a number like 119
    options.setCapability("browserVersion", "Latest");
    options.setCapability("testable:options", testableOpts);

    WebDriver driver = new RemoteWebDriver(new URL("https://selenium.testable.io/wd/hub"), options);
    driver.get("https://www.google.com");
    driver.quit();
  }

}

This very simple example loads google.com in the latest version of Chrome.

After running your test, you should be able to login to Testable and see your session under Recent Test Runs.

Recent Runs

Click the magnifying glass to view the full test report including a video recording, metrics, Selenium logs, etc.

Test Results

That’s it! Go ahead and try these same steps with your own scripts and feel free to contact us with any questions.