Running Playwright Tests Remotely Using TestGrid
Overview
This guide helps you quickly set up and run Playwright tests on a remote browser using TestGrid’s cloud infrastructure. With just a few commands, you can execute your tests, watch them run in real-time, and view detailed logs and videos — all from your local system.
Prerequisites
Before running your first test, ensure the following requirements are met:
- Node.js installed (v14 or higher)
Verify installation by running:
node -v
npm -v - Playwright installed
If not already installed, use the following commands:
npm install -D @playwright/test npx playwright install
- TestGrid access
-
- Valid User Token
- Correct SELENIUM_REMOTE_URL
- Your unique Device ID (UDID)
- Internet connection for remote browser access
Step 1: Navigate to the Playwright Section in the TestGrid Dashboard
- Log in to your TestGrid account.
- From the left-hand menu, click on Playwright.
- This section provides device options, setup instructions, and the remote execution command.

Step 2: Create or Download a Sample Project
You can either create a new Playwright test project or download a sample project provided on the TestGrid dashboard.
After downloading, open your terminal and navigate to the project directory:
cd ~/Downloads/sample_playwright_project
Ensure the directory contains a valid playwright.config.ts or playwright.config.js file.
Step 3: Execute the Remote Test Command
To run your tests on a remote browser, copy the provided command from the dashboard and execute it in your terminal within the project directory.
Example for Mac os:
Step 1: env variables (each on its own line)
SELENIUM_REMOTE_URL=http://{your_domain}.testgrid.io/browserrun{port}
SELENIUM_REMOTE_CAPABILITIES={
"browserName": "chrome",
"tg:udid": "101",
"tg:userToken": "{User_token}"
}
Step 2: Run Playwright
npx playwright test --headed
Example for Windows os:
Step 1: env variables (each on its own line)
set SELENIUM_REMOTE_URL=http://{your_domain}.testgrid.io/browserrun{port}
set SELENIUM_REMOTE_CAPABILITIES={
"browserName": "chrome",
"tg:udid": "101",
"tg:userToken": "{User_token}"
}
Step 2: Run Playwright
npx playwright test --headed
This is for windows cmd, to run playwright testcases.
Replace {your_domain}, {port}, and {User_token} with your actual TestGrid values.
Note on Browser Support
- Safari browser is currently not supported for Playwright test execution on TestGrid.
At this time, Playwright tests can be executed remotely only on supported browsers such as Chromium and Firefox.
Safari/WebKit-based execution is not available yet and will be considered in future updates.
Step 4: View Execution Results
You can view the test results in two ways:
- Local Output
- Execution logs are shown in the terminal.
- A local HTML report will be generated.
- TestGrid Dashboard
- Navigate to the “Automations” section.
- You can access:
- Execution logs
- Video recordings
- Session-level reports and artifacts



