LambdaTest Cheat Sheet
Overview
LambdaTest is a cloud-based testing infrastructure platform that allows developers and QA teams to perform manual and automated cross-browser testing across 3000+ browser-OS combinations. It provides a scalable Selenium Grid, Cypress testing cloud, Playwright integration, and real device testing for both web and mobile applications.
LambdaTest offers features including parallel test execution, geolocation testing, network simulation, visual regression testing with Smart UI, and integrations with CI/CD tools, project management platforms, and communication tools. It supports Selenium, Cypress, Playwright, Puppeteer, Appium, and Espresso test frameworks.
Installation
# LambdaTest Tunnel (local testing)
# Linux
wget https://downloads.lambdatest.com/tunnel/v3/linux/64bit/LT_Linux.zip
unzip LT_Linux.zip
# macOS
brew install lambdatest/tap/lambdatest-tunnel
# Selenium WebDriver (Node.js)
npm install selenium-webdriver
# Cypress integration
npm install -D lambdatest-cypress-cli
# Playwright
npm install -D @playwright/test
LambdaTest Tunnel
# Start tunnel
./LT --user YOUR_USERNAME --key YOUR_ACCESS_KEY
# Named tunnel
./LT --user YOUR_USERNAME --key YOUR_ACCESS_KEY \
--tunnelName my-tunnel
# With proxy
./LT --user YOUR_USERNAME --key YOUR_ACCESS_KEY \
--proxy-host proxy.example.com \
--proxy-port 8080
# Shared tunnel for team
./LT --user YOUR_USERNAME --key YOUR_ACCESS_KEY \
--shared-tunnel
Selenium Automation
const { Builder } = require("selenium-webdriver");
const capabilities = {
browserName: "Chrome",
browserVersion: "latest",
"LT:Options": {
platform: "Windows 11",
build: "Build 1.0",
name: "Homepage Test",
project: "My Project",
resolution: "1920x1080",
network: true,
console: true,
video: true,
visual: true,
username: process.env.LT_USERNAME,
accessKey: process.env.LT_ACCESS_KEY,
},
};
async function runTest() {
const driver = new Builder()
.usingServer(
`https://${process.env.LT_USERNAME}:${process.env.LT_ACCESS_KEY}@hub.lambdatest.com/wd/hub`
)
.withCapabilities(capabilities)
.build();
try {
await driver.get("https://example.com");
const title = await driver.getTitle();
// Mark test status
await driver.executeScript(
`lambda-status=${title ? "passed" : "failed"}`
);
} finally {
await driver.quit();
}
}
Python
from selenium import webdriver
lt_options = {
"platform": "Windows 11",
"build": "Build 1.0",
"name": "Python Test",
"video": True,
"network": True,
"console": True,
"w3c": True,
}
options = webdriver.ChromeOptions()
options.browser_version = "latest"
options.set_capability("LT:Options", lt_options)
driver = webdriver.Remote(
command_executor=f"https://{username}:{access_key}@hub.lambdatest.com/wd/hub",
options=options,
)
driver.get("https://example.com")
driver.execute_script("lambda-status=passed")
driver.quit()
Cypress Integration
# Initialize LambdaTest config
npx lambdatest-cypress init
# Run Cypress tests on LambdaTest
npx lambdatest-cypress run
{
"lambdatest_auth": {
"username": "YOUR_USERNAME",
"access_key": "YOUR_ACCESS_KEY"
},
"browsers": [
{
"browser": "Chrome",
"platform": "Windows 11",
"versions": ["latest"]
},
{
"browser": "Firefox",
"platform": "macOS Sonoma",
"versions": ["latest"]
}
],
"run_settings": {
"cypress_config_file": "cypress.config.js",
"build_name": "Cypress Build",
"parallels": 5,
"specs": "cypress/e2e/**/*.cy.js"
}
}
Playwright Integration
// playwright.config.js
const { defineConfig } = require("@playwright/test");
module.exports = defineConfig({
use: {
connectOptions: {
wsEndpoint: `wss://cdp.lambdatest.com/playwright?capabilities=${encodeURIComponent(
JSON.stringify({
browserName: "Chrome",
browserVersion: "latest",
"LT:Options": {
platform: "Windows 11",
build: "Playwright Build",
name: "PW Test",
username: process.env.LT_USERNAME,
accessKey: process.env.LT_ACCESS_KEY,
},
})
)}`,
},
},
});
Capabilities Reference
| Capability | Description |
|---|---|
platform | OS (Windows 11, macOS Sonoma, etc.) |
browserName | Chrome, Firefox, Safari, Edge, etc. |
browserVersion | Version number or “latest” |
resolution | Screen resolution (1920x1080, etc.) |
video | Record video (true/false) |
visual | Capture screenshots (true/false) |
network | Capture network logs (true/false) |
console | Capture console logs (true/false) |
tunnel | Use LambdaTest tunnel (true/false) |
tunnelName | Named tunnel identifier |
geoLocation | Country code for geolocation testing |
timezone | Timezone for testing |
idleTimeout | Session idle timeout in seconds |
selenium_version | Selenium version to use |
Advanced Usage
Geolocation Testing
const capabilities = {
"LT:Options": {
geoLocation: "US",
timezone: "US/Eastern",
// ...
},
};
Network Throttling
const capabilities = {
"LT:Options": {
networkThrottling: "Regular 4G",
// Options: Regular 2G, Good 2G, Regular 3G, Good 3G,
// Regular 4G, DSL, WiFi, Custom
},
};
Parallel Testing
# Run parallel Selenium tests
# Configure parallelism in your test runner
# LambdaTest handles concurrent sessions
# Check concurrency limits
curl -u "USERNAME:ACCESS_KEY" \
https://api.lambdatest.com/automation/api/v1/platforms
API Reference
# List builds
curl -u "USERNAME:ACCESS_KEY" \
https://api.lambdatest.com/automation/api/v1/builds
# Get session details
curl -u "USERNAME:ACCESS_KEY" \
https://api.lambdatest.com/automation/api/v1/sessions/SESSION_ID
# Delete session
curl -X DELETE -u "USERNAME:ACCESS_KEY" \
https://api.lambdatest.com/automation/api/v1/sessions/SESSION_ID
# Stop session
curl -X PUT -u "USERNAME:ACCESS_KEY" \
https://api.lambdatest.com/automation/api/v1/sessions/SESSION_ID/stop
Configuration
# Environment variables
export LT_USERNAME="your_username"
export LT_ACCESS_KEY="your_access_key"
export LT_BUILD_NAME="CI Build #${BUILD_NUMBER}"
# GitHub Actions integration
# .github/workflows/lambdatest.yml
# name: LambdaTest
# on: [push]
# jobs:
# test:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - uses: LambdaTest/LambdaTest-tunnel-action@v2
# with:
# user: ${{ secrets.LT_USERNAME }}
# accessKey: ${{ secrets.LT_ACCESS_KEY }}
# tunnelName: "github-tunnel"
# - run: npm test
Troubleshooting
| Issue | Solution |
|---|---|
| Tunnel connection failed | Check credentials; verify port 443 is open |
| Session timeout | Increase idleTimeout capability; default is 90s |
| Tests queued | Check plan concurrency limits; reduce parallel count |
| Video not available | Ensure video: true in capabilities |
| Geolocation not working | Verify country code is valid; some locations are limited |
| Selenium version mismatch | Specify selenium_version in LT:Options |
| Local site not loading | Start tunnel before running tests; use tunnel: true capability |
| Flaky tests | Enable network and console logging for debugging |