---
title: Migrate your existing Selenium tests to TestingBot
description: Migrate your local Selenium tests to the TestingBot cloud provider.
source_url:
  html: https://testingbot.com/support/web-automate/selenium/migrate-existing-tests
  md: https://testingbot.com/support/web-automate/selenium/migrate-existing-tests.md
---

# 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](https://testingbot.com/users/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:

[Ruby](https://testingbot.com#) [Python](https://testingbot.com#) [PHP](https://testingbot.com#) [Java](https://testingbot.com#) [NodeJS](https://testingbot.com#) [C#](https://testingbot.com#)

```ruby
options = Selenium::WebDriver::Chrome::Options.new
options.browser_version = 'latest'
options.platform_name = 'WIN11'
options.add_option('tb:options', {
  'key' => 'API_KEY',
  'secret' => 'API_SECRET',
  'name' => 'My First Test'
})
```

```java
ChromeOptions options = new ChromeOptions();
options.setPlatformName("WIN11");
options.setBrowserVersion("latest");

HashMap<String, Object> tbOptions = new HashMap<>();
tbOptions.put("key", "API_KEY");
tbOptions.put("secret", "API_SECRET");
tbOptions.put("name", "My First Test");
options.setCapability("tb:options", tbOptions);
```

```php
$capabilities = DesiredCapabilities::chrome();
$capabilities->setCapability('platformName', 'WIN11');
$capabilities->setCapability('browserVersion', 'latest');
$capabilities->setCapability('tb:options', [
    'key' => 'API_KEY',
    'secret' => 'API_SECRET',
    'name' => 'My First Test'
]);
```

```python
from selenium.webdriver.chrome.options import Options

options = Options()
options.browser_version = 'latest'
options.platform_name = 'WIN11'
options.set_capability('tb:options', {
    'key': 'API_KEY',
    'secret': 'API_SECRET',
    'name': 'My First Test'
})
```

```javascript
const chrome = require('selenium-webdriver/chrome');

let options = new chrome.Options();
options.setBrowserVersion('latest');
options.setPlatformName('WIN11');
options.set('tb:options', {
    'key': 'API_KEY',
    'secret': 'API_SECRET',
    'name': 'My First Test'
});
```

```csharp
// for Chrome
ChromeOptions options = new ChromeOptions();

// for Firefox
// FirefoxOptions options = new FirefoxOptions();

// for Safari
// SafariOptions options = new SafariOptions();

options.PlatformName = "WIN11";
options.BrowserVersion = "latest";
options.AddAdditionalOption("tb:options", new Dictionary<string, object>
{
    ["key"] = "API_KEY",
    ["secret"] = "API_SECRET",
    ["name"] = "My First Test"
});
```

## 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](https://testingbot.com#capabilities) to our cloud endpoint:

```bash
https://hub.testingbot.com/wd/hub
```

Below is an example on how to do this:

[Ruby](https://testingbot.com#) [Python](https://testingbot.com#) [PHP](https://testingbot.com#) [Java](https://testingbot.com#) [NodeJS](https://testingbot.com#) [C#](https://testingbot.com#)

```ruby
require 'selenium-webdriver'

options = Selenium::WebDriver::Chrome::Options.new
options.browser_version = 'latest'
options.platform_name = 'WIN11'
options.add_option('tb:options', {
  'key' => 'API_KEY',
  'secret' => 'API_SECRET',
  'name' => 'My First Test'
})

driver = Selenium::WebDriver.for(:remote,
  url: 'https://hub.testingbot.com/wd/hub',
  options: options
)
driver.navigate.to 'https://www.google.com'

# Your test logic here

driver.quit
```

```java
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.remote.RemoteWebDriver;
import java.net.URL;
import java.util.HashMap;

public class TestingBotSampleTest {
    public static void main(String[] args) throws Exception {
        ChromeOptions options = new ChromeOptions();
        options.setPlatformName("WIN11");
        options.setBrowserVersion("latest");

        HashMap<String, Object> tbOptions = new HashMap<>();
        tbOptions.put("key", "API_KEY");
        tbOptions.put("secret", "API_SECRET");
        tbOptions.put("name", "My First Test");
        options.setCapability("tb:options", tbOptions);

        WebDriver driver = new RemoteWebDriver(
            new URL("https://hub.testingbot.com/wd/hub"), options
        );
        driver.get("https://www.google.com");

        // Your test logic here

        driver.quit();
    }
}
```

```php
<?php
require_once('vendor/autoload.php');
use Facebook\WebDriver\Remote\RemoteWebDriver;
use Facebook\WebDriver\Remote\DesiredCapabilities;

$capabilities = DesiredCapabilities::chrome();
$capabilities->setCapability('platformName', 'WIN11');
$capabilities->setCapability('browserVersion', 'latest');
$capabilities->setCapability('tb:options', [
    'key' => 'API_KEY',
    'secret' => 'API_SECRET',
    'name' => 'My First Test'
]);

$driver = RemoteWebDriver::create(
    'https://hub.testingbot.com/wd/hub',
    $capabilities
);

$driver->get('https://www.google.com');

// Your test logic here

$driver->quit();
```

```python
from selenium import webdriver
from selenium.webdriver.chrome.options import Options

options = Options()
options.browser_version = 'latest'
options.platform_name = 'WIN11'
options.set_capability('tb:options', {
    'key': 'API_KEY',
    'secret': 'API_SECRET',
    'name': 'My First Test'
})

driver = webdriver.Remote(
    command_executor='https://hub.testingbot.com/wd/hub',
    options=options
)

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

# Your test logic here

driver.quit()
```

```javascript
const { Builder } = require('selenium-webdriver');
const chrome = require('selenium-webdriver/chrome');

async function runTest() {
    let options = new chrome.Options();
    options.setBrowserVersion('latest');
    options.setPlatformName('WIN11');
    options.set('tb:options', {
        'key': 'API_KEY',
        'secret': 'API_SECRET',
        'name': 'My First Test'
    });

    let driver = await new Builder()
        .usingServer('https://hub.testingbot.com/wd/hub')
        .setChromeOptions(options)
        .build();

    await driver.get('https://www.google.com');

    // Your test logic here

    await driver.quit();
}
runTest();
```

```csharp
using System;
using System.Collections.Generic;
using OpenQA.Selenium;
using OpenQA.Selenium.Remote;
using OpenQA.Selenium.Chrome;

namespace SeleniumTest {
    class Program {
        static void Main(string[] args) {
            ChromeOptions options = new ChromeOptions();
            options.PlatformName = "WIN11";
            options.BrowserVersion = "latest";
            options.AddAdditionalOption("tb:options", new Dictionary<string, object>
            {
                ["key"] = "API_KEY",
                ["secret"] = "API_SECRET",
                ["name"] = "My First Test"
            });

            IWebDriver driver = new RemoteWebDriver(
                new Uri("https://hub.testingbot.com/wd/hub"), options
            );
            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](https://testingbot.com/support/web-automate/selenium).   
 Simply 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](https://testingbot.com/contact/new) and we'll be happy to help.

## Test your private websites on TestingBot

TestingBot offers a feature called [TestingBot Tunnel](https://testingbot.com/support/tunnel) which allows you to run tests against websites hosted on your computer or private network.

### Looking for more help?

Have questions or need more information? Reach out via email or Slack.

[Email us](https://testingbot.com/contact/new) [Join our Slack](https://join.slack.com/t/testingb0t/shared_invite/zt-3bcw9xch-jk19~6XPs_xBrsAgAedkCw)
