Features

Migrate your existing tests

Migrating your existing Selenium WebDriver tests to use TestingBot is easy.
On this page, we'll show you how to modify your existing tests and run them on the browsers in our cloud.

Authentication

First, you'll need to authenticate to the TestingBot cloud.
If you haven't already, please sign up for a free trial and find your TestingBot key and secret in the member area.
You'll need to use these credentials in your test scripts to authenticate with our cloud.

Capabilities

Capabilities are used to indicate on which browsers you want to test.
You can specify a desired browser name, operating system and browser version.

For example, let's say you want to test on the latest Chrome browser on Windows 10:

Copy code
caps = Selenium::WebDriver::Remote::Capabilities.new

caps['platform'] = 'WIN10'
caps['browserName'] = 'chrome'
caps['version'] = 'latest'
caps['name'] = 'My First Test'
Copy code
DesiredCapabilities caps = new DesiredCapabilities();

caps.setCapability("platform", "WIN10");
caps.setCapability("browserName", "chrome");
caps.setCapability("version", "latest");
caps.setCapability("name", "My First Test");
Copy code
$caps = array(
  "version" => "latest",
  "browserName" => "chrome",
  "platform" => "WIN10",
  "name" => "My First Test"
);
Copy code
desired_cap = {
 'browserName': 'chrome',
 'version': 'latest',
 'platform': 'WIN10',
 'name': 'My First Test'
}
Copy code
const capabilities = {
  'platform': 'WIN10',
  'browserName': 'chrome',
  'version': 'latest',
  'name': 'My First Test'
}
Copy code
IWebDriver driver;
// for Chrome
OpenQA.Selenium.Chrome.ChromeOptions capability = new OpenQA.Selenium.Chrome.ChromeOptions();

// for Firefox
OpenQA.Selenium.Firefox.FirefoxOptions capability = new OpenQA.Selenium.Firefox.FirefoxOptions();

// for Safari
OpenQA.Selenium.Safari.SafariOptions capability = new OpenQA.Selenium.Safari.SafariOptions();

capability.AddAdditionalCapability("platform", "WIN10", true);
capability.AddAdditionalCapability("browserName", "chrome", true);
capability.AddAdditionalCapability("version", "latest", true);
capability.AddAdditionalCapability("name", "My First Test", true);

Running tests with Remote WebDriver

If you have been running tests on your local machine until now, then you will need to modify your test scripts to start a WebDriver session via Remote WebDriver.
Simply send the capabilities to our cloud endpoint:

Copy code
https://API_KEY:API_SECRET@hub.testingbot.com/wd/hub

Below is an example on how to do this:

Copy code
require "rubygems"
require "selenium-webdriver"

caps = Selenium::WebDriver::Remote::Capabilities.new

caps["browserName"] = "Firefox"
caps["version"] = "latest"
caps["platform"] = "WIN10"
caps["name"] = "firefox profile example"

driver = Selenium::WebDriver.for(:remote,
  :url => "https://API_KEY:API_SECRET@hub.testingbot.com/wd/hub",
  :desired_capabilities => caps)
  driver.navigate.to 'https://www.google.com'

# Your test logic here

driver.quit
Copy code
import org.openqa.selenium.By;
import org.openqa.selenium.Platform;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import java.net.URL;

public class TestingBotSampleTest {
    public static final String URL = "https://API_KEY:API_SECRET@hub.testingbot.com/wd/hub";
    public static void main(String[] args) throws Exception {
      DesiredCapabilities caps = new DesiredCapabilities();

      caps.setCapability("platform", "WIN10");
      caps.setCapability("browserName", "Chrome");
      caps.setCapability("version", "latest");

      WebDriver driver = new RemoteWebDriver(new URL(URL), caps);
      driver.get("https://www.google.com");

      // Your test logic here

      driver.quit();
    }
}
Copy code
<?php 
  require_once('vendor/autoload.php');
  use Facebook\WebDriver\Remote\RemoteWebDriver;
  use Facebook\WebDriver\WebDriverBy;

  $URL = "https://API_KEY:API_SECRET@hub.testingbot.com/wd/hub";

  $caps = array(
    "version" => "latest",
    "browserName" => "chrome",
    "platform" => "WIN10",
    "name" => "My First Test"
  );

  $web_driver = RemoteWebDriver::create(
      $URL,
      $caps
  );

  $web_driver->get("https://www.google.com");

  // Your test logic here

  $web_driver->quit();
Copy code
from selenium import webdriver

URL = 'https://API_KEY:API_SECRET@hub.testingbot.com/wd/hub'

desired_cap = {
 'browserName': 'chrome',
 'version': 'latest',
 'platform': 'WIN10',
 'name': 'My First Test'
}

driver = webdriver.Remote(
    command_executor=URL,
    desired_capabilities=desired_cap
)

driver.get("https://www.google.com")

# Your test logic here

driver.quit())
Copy code
const webdriver = require('selenium-webdriver');

const URL = 'https://API_KEY:API_SECRET@hub.testingbot.com/wd/hub';

const capabilities = {
  'platform': 'WIN10',
  'browserName': 'chrome',
  'version': 'latest',
  'name': 'My First Test'
};

const driver = new webdriver.Builder().
usingServer(URL).
withCapabilities(capabilities).
build();

driver.get('https://www.google.com').then(function() {
  // Your test logic here

  driver.quit();
});
Copy code
using System;
using OpenQA.Selenium;
using OpenQA.Selenium.Remote;

namespace SeleniumTest {
  class Program {
    static void Main(string[] args) {
      string KEY = "KEY";
      string SECRET = "SECRET";

      OpenQA.Selenium.Chrome.ChromeOptions capability = new OpenQA.Selenium.Chrome.ChromeOptions();

      // for Firefox
      // OpenQA.Selenium.Firefox.FirefoxOptions capability = new OpenQA.Selenium.Firefox.FirefoxOptions();
      
      // for Safari
      // OpenQA.Selenium.Safari.SafariOptions capability = new OpenQA.Selenium.Safari.SafariOptions();

      capability.AddAdditionalCapability("platform", "WIN10", true);
      capability.AddAdditionalCapability("browserName", "chrome", true);
      capability.AddAdditionalCapability("version", "latest", true);
      capability.AddAdditionalCapability("key", KEY, true);
      capability.AddAdditionalCapability("secret", SECRET, true);
      capability.AddAdditionalCapability("name", "My First Test", true);

      IWebDriver driver;
      driver = new RemoteWebDriver(
        new Uri("https://hub.testingbot.com/wd/hub/"), caps
      );
      driver.Navigate().GoToUrl("https://www.google.com");

      // Your test logic here

      driver.Quit();
    }
  }
}

Migrate from one of the test frameworks

We have documentation for all the popular test frameworks.
Simple follow the documentation and examples to convert your existing tests.

If the test framework you are using is not in our documentation, please contact us and we'll be happy to help.

Test your private websites on TestingBot

TestingBot offers a feature called TestingBot Tunnel which allows you to run tests against websites hosted on your computer or private network.