Skip to main content

Launch Your First Browser Session


This guide walks you through setting up your TestMu AI account, creating your first browser session on TestMu AI Browser Cloud, and driving it using TypeScript/Puppeteer. In just a few minutes, you'll be programmatically controlling a cloud browser.

Prerequisites


Step 1: Sign up on TestMu AI

Step 2: Get your credentials:

  1. After signing up, navigate to Settings → Account Settings
  2. Find your Username and Access Key

Step 3: Set up environment variables:

  1. Create a .env file in your project root (if you don't have one)
  2. Add your credentials:
LT_USERNAME=your_username
LT_ACCESS_KEY=your_access_key

Make sure to add .env to your .gitignore file to keep your credentials secure.

Installing the TestMu AI Browser SDK


npm i @testmuai/browser-cloud

Requirements: Node.js 16+ (Node 18+ required if using the Playwright adapter)

Create Your First Session


Let's create a simple script that launches a cloud browser, navigates to a page, and cleans up:

// my-first-session.ts

import { Browser } from '@testmuai/browser-cloud';

const client = new Browser();

async function main() {
const session = await client.sessions.create({
adapter: 'puppeteer',
lambdatestOptions: {
build: 'Getting Started',
name: 'My First Session',
'LT:Options': {
username: process.env.LT_USERNAME,
accessKey: process.env.LT_ACCESS_KEY,
}
}
});

console.log('Session created:', session.id);
console.log('View live session at:', session.sessionViewerUrl);

// Connect and use the browser
const browser = await client.puppeteer.connect(session);
const page = (await browser.pages())[0];

await page.goto('https://example.com');
console.log('Title:', await page.title());

// Clean up
await browser.close();
await client.sessions.release(session.id);
console.log('Session released');
}

main().catch(console.error);

Test across 3000+ combinations of browsers, real devices & OS.

Book Demo

Help and Support

Related Articles