diff --git a/assets/images/browserstack-lambdatest-migration/Lambdatest-text-validation-result.png b/assets/images/browserstack-lambdatest-migration/Lambdatest-text-validation-result.png
new file mode 100644
index 000000000..748c0eadd
Binary files /dev/null and b/assets/images/browserstack-lambdatest-migration/Lambdatest-text-validation-result.png differ
diff --git a/docs/browserstack-to-lambdatest-migration-guide.md b/docs/browserstack-to-lambdatest-migration-guide.md
index 60f36f56a..3acdb94b3 100644
--- a/docs/browserstack-to-lambdatest-migration-guide.md
+++ b/docs/browserstack-to-lambdatest-migration-guide.md
@@ -14,6 +14,15 @@ url: https://www.lambdatest.com/support/docs/browserstack-to-lambdatest-migratio
site_name: LambdaTest
slug: browserstack-to-lambdatest-migration-guide/
---
+
+
+import CodeBlock from '@theme/CodeBlock';
+import {YOUR_LAMBDATEST_USERNAME, YOUR_LAMBDATEST_ACCESS_KEY} from "@site/src/component/keys";
+
+import Tabs from '@theme/Tabs';
+import TabItem from '@theme/TabItem';
+
+
-# Migrating from BrowserStack to LambdaTest
+# Migration from BrowserStack to LambdaTest
* * *
LambdaTest and BrowserStack both offer the cloud-based Selenium Grid. Hence, you can easily migrate your existing Selenium test automation scripts (or suites) from BrowserStack to LambdaTest
-[Note: This guide covers the migration of tests running on the cloud grid that uses Selenium 3.141.59]
-
-## Introduction
-***
-Migrating your existing tests running on BrowserStack to LambdaTest can be done with just a few lines of change. In this guide, we will see how you can use LambdaTest desired capabilities in your tests, authenticate your test session, and run tests on the browsers in our cloud.
+[Note: This guide covers the migration of tests running on the cloud grid that uses Selenium 4 and Selenium 3]
-## Changes to be made in your scripts
-***
-### Authentication
+## Authentication
Firstly, you need to change the authentication in your configuration settings of your test suite. For running tests on LambdaTest Selenium Grid, you need to have a valid user_name and access_key to perform tests on our Grid. In case you do not have an account on LambdaTest, visit the [LambdaTest signup page](https://accounts.lambdatest.com/register) and create a new account.
-
+
-* UserName
-* AccessKey
-* Hub URL
-* Desired Capabilities
+When migrating your Selenium 4 tests from BrowserStack to LambdaTest, the following updates are required in your existing code:
-Here is a side-by-side comparison of each of the fields that we have highlighted above:
+1. Get LambdaTest Credentials: You can find these credentials under Account Settings > [Password & Security](https://accounts.lambdatest.com/security/username-accesskey) and copy your Username and Access Key, then add them to the .env file to keep them safe from public exposure.
-| Property | BrowserStack | LambdaTest |
-|---|---| ---|
-| UserName (Type: String) | UserName to access Selenium Grid on BrowserStack | UserName to access Selenium Grid on LambdaTest |
-| AccessKey (Type: String) | AccessKey to access Selenium Grid on BrowserStack | AccessKey to access Selenium Grid on LambdaTest |
-| Selenium Hub URL (Type: String) | @hub-cloud.browserstack.com/wd/hub | @hub.lambdatest.com/wd/hub |
+2. Create .env file: Securely store your LambdaTest credentials, create a .env file in the root of your project and add the following values:
-For a Java-based implementation, here are the changes in the script as far as the authentication stage is concerned:
-
-**BrowserStack**
-``` js
-// test.java
-public static final String user_name = "BrowserStack_UserName";
-public static final String access_key = "BrowserStack_AccessKey";
```
-**LambdaTest**
-``` js
-// test.java
-public static final String user_name = "LambdaTest_UserName";
-public static final String access_key = "LambdaTest_AccessKey";
+LT_USERNAME=""
+LT_ACCESS_KEY=""
```
-### Changes in Hub URL
-You need to now change the hub URL in the configuration settings of your test suite. Hub URL is of type String and it defines the Hub location to which the Selenium tests would be submitted for execution.
+Once the .env file is set up, ensure your test framework correctly reads these variables at runtime. This helps keep your authentication secure and avoids hard-coding credentials within your scripts. With the credentials in place, you’re now ready to update your Hub URL for LambdaTest execution.
-Here is a side-by-side comparison of the Hub URL for BrowserStack and LambdaTest:
-| Property | BrowserStack | LambdaTest |
-|---|---| ---|
-| Selenium Hub URL (Type: String) | @hub-cloud.browserstack.com/wd/hub | @hub.lambdatest.com/wd/hub |
+## Changes in Hub URL
+You need to now change the hub URL in the configuration settings of your test suite. Hub URL is of type String and it defines the Hub location to which the Selenium tests would be submitted for execution.
-For a Java-based implementation, here are the changes in the script as far as the Hub URL is concerned:
+
-**BrowserStack**
-``` js
-// test.java
-public static final String Hub_URL = "https://" + user_name + ":" + access_key + "@hub-cloud.browserstack.com/wd/hub";
+
+
+```js
+@hub-cloud.browserstack.com/wd/hub
```
-**LambdaTest**
-``` js
-// test.java
-public static final String Hub_URL = "https://" + user_name + ":" + access_key + "@hub.lambdatest.com/wd/hub";
+
+
+
+
+
+```js
+@hub.lambdatest.com/wd/hub
```
-### Capabilities Generator
+
+
+
+
+## Configuring Selenium 4 Tests on LambdaTest
+***
+Migrating your Selenium 4 tests from BrowserStack to LambdaTest requires only a few small updates. In this guide, we’ll walk through how to apply LambdaTest’s W3C-compliant capabilities, configure authentication, and execute your Selenium 4 test sessions on real browsers hosted in the LambdaTest cloud.
+
+***
+
+### LambdaTest Automation Capabilities
+
Capabilities generator let you configure the desired capabilities (or capabilities) which are configuration options that let you set the following:
* Desired browser
@@ -125,163 +120,262 @@ Optionally, you can also choose the Selenium version and other advanced options
For the migration, we have considered Java-based Selenium automation tests. Shown below are the screenshots of capabilities generator of BrowserStack and LambdaTest:
-**BrowserStack**
+
+
+
-
+```js
+MutableCapabilities capabilities = new MutableCapabilities();
+HashMap bstackOptions = new HashMap();
+capabilities.setCapability("browserName", "Chrome");
+bstackOptions.put("os", "OS X");
+bstackOptions.put("osVersion", "Tahoe");
+bstackOptions.put("browserVersion", "latest");
+bstackOptions.put("userName", "YOUR_USERNAME");
+bstackOptions.put("accessKey", "YOUR_ACCESS_KEY");
+bstackOptions.put("consoleLogs", "info");
+capabilities.setCapability("bstack:options", bstackOptions);
+```
+
+
+
+
+
+```js
+ChromeOptions browserOptions = new ChromeOptions();
+browserOptions.setPlatformName("Windows 10");
+browserOptions.setBrowserVersion("dev");
+HashMap ltOptions = new HashMap();
+ltOptions.put("username", "");
+ltOptions.put("accessKey", "");
+ltOptions.put("w3c", true);
+browserOptions.setCapability("LT:Options", ltOptions);
+```
+
+
-**LambdaTest**
+
+
+To generate capabilities use [LambdaTest Capabilities Generator](https://www.lambdatest.com/capabilities-generator/) to define key automation testing parameters, such as browser, version, operating system, and additional test settings.
+
+
+
+## Configuring Selenium 3 Tests on LambdaTest
+***
+Migrating your Selenium 3 tests from BrowserStack to LambdaTest requires only a few simple configuration changes. In the sections below, we’ll guide you through updating your test setup, applying Selenium 3–compatible capabilities, and running your test sessions on real browsers hosted on the LambdaTest cloud.
+***
-You can generate the corresponding Selenium capabilities using the [LambdaTest capabilities generator](https://www.lambdatest.com/capabilities-generator/). Capabilities matching the ones shown in the BrowserStack capabilities screenshot is below:
+### LambdaTest Automation Capabilities
-
+The Capabilities Generator allows you to configure the required desired capabilities for Selenium 3 test execution. These capabilities define the browser environment in which your tests will run.
-Shown below is the comparison of the capabilities generated by BrowserStack and LambdaTest capabilities generator:
+With Selenium 3, the core capabilities remain:
-| Capabilities | BrowserStack | LambdaTest |
-|---|---| ---|
-| Browser | browser | browserName |
-| Browser Version | browser_version | version |
-| Platform Name | os | platform |
-| Platform Version | os_version | N.A |
+* Browser Name (e.g., Chrome, Firefox, Edge)
+* Browser Version
+* Operating System / Platform
-The platform (or OS) version is a part of the platform name in LambdaTest. Hence, it is mentioned as NA (Not Applicable) in the Capabilities Comparison Table.
+Optionally, you may also configure Selenium versions or other advanced settings based on your test requirements. However, for this migration guide, we will primarily focus on the three fundamental capabilities listed above.
-Here is the summary of the comparison of Desired Capabilities for `Java` language:
+Below are example capability representations from BrowserStack and LambdaTest to help you understand how to adapt your existing configuration during migration.
-**BrowserStack**
-``` js
-// test.java
+
+
+
+
+
+```js
DesiredCapabilities caps = new DesiredCapabilities();
-caps.setCapability("os", "Windows");
-caps.setCapability("os_version", "10");
caps.setCapability("browser", "Chrome");
+caps.setCapability("os", "OS X");
+caps.setCapability("os_version", "Tahoe");
caps.setCapability("browser_version", "latest");
-caps.setCapability("browserstack.local", "false");
-caps.setCapability("browserstack.selenium_version", "3.141.59");
+caps.setCapability("browserstack.user", "YOUR_USERNAME");
+caps.setCapability("browserstack.key", "YOUR_ACCESS_KEY");
+caps.setCapability("browserstack.console", "info");
```
-**LambdaTest**
-``` js
-// test.java
+
+
+
+
+
+```js
DesiredCapabilities capabilities = new DesiredCapabilities();
-capabilities.setCapability("build", "your build name");
-capabilities.setCapability("name", "your test name");
-capabilities.setCapability("platform", "Windows 10");
-capabilities.setCapability("browserName", "Chrome");
-capabilities.setCapability("version","92.0");
+capabilities.setCapability("browserName", "Safari");
+capabilities.setCapability("browserVersion", "26");
+HashMap ltOptions = new HashMap();
+ltOptions.put("username", "");
+ltOptions.put("accessKey", "");
+ltOptions.put("visual", true);
+ltOptions.put("video", true);
+ltOptions.put("platformName", "MacOS Tahoe");
+capabilities.setCapability("LT:Options", ltOptions);
```
-## Hands On Guide - BrowserStack To LambdaTest Migration
+
+
+
+
+To generate capabilities for Selenium 3, you can use the [LambdaTest Capabilities Generator](https://www.lambdatest.com/capabilities-generator/) , which allows you to define essential automation parameters such as browser name, browser version, operating system, along with any additional test configurations required for execution.
+
+
+## Hands On Guide - LambdaTest Migration
***
-Let’s take a practical example that demonstrates the entire migration process. The test scenario is to open Google on Chrome (version 92.0) that is installed on a Windows 10 machine.
+Let’s walk through a practical example demonstrating how to migrate a Selenium 4 test to LambdaTest. In this scenario, we launch the latest Chrome browser on a Windows 10 machine.
+
+**Test Scenario**:
+
+This test script performs a basic text validation on the website [LambdaTest eCommerce Playground](https://ecommerce-playground.lambdatest.io/) and shows the expected execution results when running the test in the LambdaTest cloud.
+
+
+
+
+
+
+```java
+// TextValidationTest.java
-### BrowserStack
-``` js
-// test.java
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.chrome.ChromeOptions;
import org.openqa.selenium.remote.RemoteWebDriver;
+
import java.net.URL;
-
-public class BrowserStackSampleTest
-{
- public static final String user_name = "BrowserStack_user_name";
- public static final String access_key = "BrowserStack_access_key";
- public static final String grid_url = "https://" + user_name + ":" + access_key + "@hub-cloud.browserstack.com/wd/hub";
- public static void main(String[] args) throws Exception
- {
- DesiredCapabilities caps = new DesiredCapabilities();
-
- caps.setCapability("build", "Build #1");
- caps.setCapability("name", "Sample project");
- caps.setCapability("os", "Windows");
- caps.setCapability("os_version", "10");
- caps.setCapability("browser", "Chrome");
- caps.setCapability("browser_version", "92.0");
-
- WebDriver driver = new RemoteWebDriver(new URL(grid_url), caps);
- driver.get("http://www.google.com");
-
+import java.util.HashMap;
+
+public class TextValidationTest {
+
+ public static void main(String[] args) throws Exception {
+
+ // ---------------- Authentication using Environment Variables ----------------
+ String username = System.getenv("LT_USERNAME") == null ? "Your LT Username" : System.getenv("LT_USERNAME"); // If env variables are unavailable, you may hard-code credentials here.
+ String authkey = System.getenv("LT_ACCESS_KEY") == null ? "Your LT AccessKey" : System.getenv("LT_ACCESS_KEY"); // If env variables are unavailable, you may hard-code credentials here.
+
+ String GRID_URL = "https://" + username + ":" + authkey + "@hub.lambdatest.com/wd/hub";
+
+ // ---------------- Selenium 4 Browser Options (Runs on LambdaTest Cloud) ----------------
+ ChromeOptions browserOptions = new ChromeOptions();
+ browserOptions.setPlatformName("Windows 10");
+ browserOptions.setBrowserVersion("latest");
+
+ HashMap ltOptions = new HashMap();
+ ltOptions.put("username", username);
+ ltOptions.put("accessKey", authkey);
+ ltOptions.put("project", "Text Validation Test");
+ ltOptions.put("build", "Text Validation Test Build");
+ ltOptions.put("selenium_version", "4.0.0");
+ ltOptions.put("w3c", true);
+
+ browserOptions.setCapability("LT:Options", ltOptions);
+
+ // ---------------- Start Remote WebDriver Session ----------------
+ WebDriver driver = new RemoteWebDriver(new URL(GRID_URL), browserOptions);
+
+ // 1. Visit Page
+ driver.get("https://ecommerce-playground.lambdatest.io/");
+
+ // 2. Text Validation
+ String expectedText = "This is a dummy website for Web Automation Testing";
+ boolean isTextPresent = driver.getPageSource().contains(expectedText);
+
+ if (isTextPresent) {
+ System.out.println("✔ Text validation PASSED");
+ System.out.println("Found: " + expectedText);
+ } else {
+ System.out.println("✘ Text validation FAILED");
+ }
+
+ // ---------------- End Session ----------------
driver.quit();
}
}
```
-### LambdaTest
-``` js
-// test.java
+
+
+
+
+```java
+// TextValidationTest.java – Selenium 3 Configuration
+
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 LambdaTestSampleTest
-{
- public static final String user_name = "LambdaTest_user_name";
- public static final String access_key = "LambdaTest_access_key";
- public static final String grid_url = "https://" + user_name + ":" + access_key + "@hub.lambdatest.com/wd/hub";
- public static void main(String[] args) throws Exception
- {
- DesiredCapabilities caps = new DesiredCapabilities();
-
- capabilities.setCapability("build", "Build #1");
- capabilities.setCapability("name","Sample project");
- capabilities.setCapability("platform", "Windows 10 ");
- capabilities.setCapability("browserName", "Chrome");
- capabilities.setCapability("version", "92.0");
-
- WebDriver driver = new RemoteWebDriver(new URL(grid_url), caps);
- driver.get("http://www.google.com");
-
+import java.util.HashMap;
+
+public class TextValidationTest {
+
+ public static void main(String[] args) throws Exception {
+
+ // ================== LambdaTest Authentication via ENV Vars ==================
+ String username = System.getenv("LT_USERNAME") == null ? "Your LT Username" : System.getenv("LT_USERNAME"); // If env variables are unavailable, you may hard-code credentials here.
+ String authkey = System.getenv("LT_ACCESS_KEY") == null ? "Your LT AccessKey" : System.getenv("LT_ACCESS_KEY"); // If env variables are unavailable, you may hard-code credentials here.
+ String GRID_URL = "https://" + username + ":" + authkey + "@hub.lambdatest.com/wd/hub";
+
+ // ================== Selenium 3 LambdaTest Capabilities ==================
+ DesiredCapabilities capabilities = new DesiredCapabilities();
+ capabilities.setCapability("browserName", "Safari");
+ capabilities.setCapability("browserVersion", "26");
+
+ HashMap ltOptions = new HashMap();
+ ltOptions.put("username", username); // pulled dynamically
+ ltOptions.put("accessKey", authkey); // pulled dynamically
+ ltOptions.put("visual", true);
+ ltOptions.put("video", true);
+ ltOptions.put("platformName", "MacOS Tahoe");
+
+
+ capabilities.setCapability("LT:Options", ltOptions);
+
+ // ================== Start Selenium 3 Remote WebDriver ==================
+ WebDriver driver = new RemoteWebDriver(new URL(GRID_URL), capabilities);
+
+ // 1. Open Website
+ driver.get("https://ecommerce-playground.lambdatest.io/");
+
+ // 2. Validate expected UI text
+ String expectedText = "This is a dummy website for Web Automation Testing";
+ boolean isTextPresent = driver.getPageSource().contains(expectedText);
+
+ if (isTextPresent) {
+ System.out.println("✔ Text validation PASSED");
+ System.out.println("Found: " + expectedText);
+ } else {
+ System.out.println("✘ Text validation FAILED");
+ }
+
driver.quit();
}
}
+
```
-As seen above, the majority of the implementation is unchanged. Changes are only made on the infrastructure side (i.e. instead of BrowserStack, the tests would be run on LambdaTest).
+
-Here is a side-by-side comparison of what has changed from the implementation point of view:
+
+
+
+
+
+
+
+
+
+
+
+
+**Result**
+
+Visit LambdaTest Web Automation dashboard to view your test execution result.
+
+
-**BrowserStack**
-``` js
-// test.java
-public static final String user_name = "BrowserStack_user_name";
-public static final String access_key = "BrowserStack_access_key";
-public static final String grid_url = "https://" + user_name + ":" + access_key + "@hub-cloud.browserstack.com/wd/hub";
-public static void main(String[] args) throws Exception
-{
- DesiredCapabilities caps = new DesiredCapabilities();
- caps.setCapability("build", "Build #1");
- caps.setCapability("name", "Sample project");
- caps.setCapability("os", "Windows");
- caps.setCapability("os_version", "10");
- caps.setCapability("browser", "Chrome");
- caps.setCapability("browser_version", "92.0");
-```
-**LambdaTest**
-``` js
-// test.java
-public static final String user_name = "LambdaTest_user_name";
-public static final String access_key = "LambdaTest_access_key";
-public static final String grid_url = "https://" + user_name + ":" + access_key + "@hub.lambdatest.com/wd/hub";
-public static void main(String[] args) throws Exception
-{
- DesiredCapabilities caps = new DesiredCapabilities();
-
- capabilities.setCapability("build", "Build #1");
- capabilities.setCapability("name","Sample project");
- capabilities.setCapability("platform", "Windows 10 ");
- capabilities.setCapability("browserName", "Chrome");
- capabilities.setCapability("version", "92.0");
-```