For AI agents and LLMs: a machine-readable index is available at llms.txt. A plain-Markdown version of any documentation page is available by appending .md to its URL.
Skip to main content

How to Migrate Your Selenium Suite to TestMu AI


Already have Selenium End-to-End (E2E) testing running locally? You can run it on the TestMu AI cloud grid with three changes: swap the driver URL, add your credentials, and set the capabilities. Your test logic stays the same.

If you are moving from BrowserStack or Sauce Labs, use these dedicated migration guides with capability mapping tables.

Prerequisites​


Make sure you have the following set up before you start.

  1. Create a TestMu AI account if you don't have one.
  2. Get your Username and Access Key from the TestMu AI Dashboard.
  3. An existing Selenium test suite in any supported language (Java, JavaScript, Python, C#, PHP, or Ruby).

Step 1: Set Your Credentials​


Add your TestMu AI credentials as environment variables so your tests can authenticate with the grid.

Verified
export LT_USERNAME="undefined"
export LT_ACCESS_KEY="undefined"

Step 2: Replace Your Local Driver With RemoteWebDriver​


Point your tests to the TestMu AI hub instead of launching a local browser. The values you pass in LT:Options come from the full list of Selenium automation capabilities, so you can tune build name, platform, and logging to match your suite.

Find where your test creates the WebDriver instance and replace it with a RemoteWebDriver pointing to the TestMu AI hub URL:

Verified
https://{YOUR_USERNAME}:{YOUR_ACCESS_KEY}@hub.lambdatest.com/wd/hub

Here is what the change looks like in each language:

Before (local):

Verified
WebDriver driver = new ChromeDriver();

After (cloud):

Verified
String username = System.getenv("LT_USERNAME");
String accessKey = System.getenv("LT_ACCESS_KEY");
String hubURL = "https://" + username + ":" + accessKey + "@hub.lambdatest.com/wd/hub";

ChromeOptions browserOptions = new ChromeOptions();
browserOptions.setPlatformName("Windows 10");
browserOptions.setBrowserVersion("latest");

HashMap<String, Object> ltOptions = new HashMap<String, Object>();
ltOptions.put("build", "My First Cloud Build");
ltOptions.put("name", "Sample Test");
ltOptions.put("w3c", true);
browserOptions.setCapability("LT:Options", ltOptions);

WebDriver driver = new RemoteWebDriver(new URL(hubURL), browserOptions);
tip

Use the Capabilities Generator to auto-generate the capabilities code for any browser, version, and OS combination.

Step 3: Run Your Tests​


Execute your tests the same way you normally would. The only difference is they now run on the cloud. If you are new to the grid, first walk through how to run your first Selenium test to confirm your setup before migrating a full suite.

Verified
# Java (Maven)
mvn test

# JavaScript (npm)
npm test

# Python (pytest)
pytest

# C# (dotnet)
dotnet test

# PHP (PHPUnit)
vendor/bin/phpunit

# Ruby (RSpec)
bundle exec rspec

Step 4: View Your Results​


Check the Automation Dashboard to see exactly what happened during your test.

Visit the TestMu AI Automation Dashboard to see your results. Each session captures video playback, screenshots, console logs, network logs, and Selenium command logs. If a migrated test fails, use these artifacts to debug your Selenium tests and find the cause.

What Stays the Same​


Everything except the driver setup. Here is what does not change when you move to the cloud.

WhatChanges?
Test logic (assertions, flows, waits)No
Page Object ModelsNo
Test framework config (TestNG XML, pytest.ini, etc.)No
CI/CD pipeline commandsNo
Driver setup (URL + capabilities)Yes
Local browser install requirementRemoved

Next Steps​


Continue with these related guides:

Terminal First Testing With Kane CLI

Natural language browser & mobile app tests right from terminal.

×
Schedule Your Personal Demo
Kane CLI terminal

Help and Support

Related Articles