Skip to main content

Getting Started With Playwright Testing on iOS Real Devices


Playwright test automation on real iOS devices is now supported on TestMu AI across Node.js, Java, C#, and Python. Test on latest iPhone and iPad Safari combinations to catch device-specific issues that mobile emulation may miss. Integrate with your existing CI pipeline, and access logs and debugging artifacts for each test run.

This guide will cover the basics of getting started with Playwright testing on iOS devices on the TestMu AI platform.

Supported Versions
  • Playwright versions v1.53.0 and above (until v1.57.0) are supported for iOS real device testing.
  • All languages use the stock Playwright packages — no custom forks or client-side changes required.
  • Playwright v1.53.2 is currently supported for Playwright C# (for Android & iOS).

Prerequisites


Set your TestMu AI username and access key in the environment variables. You can get your TestMu AI username and access key from your TestMu AI Profile > Account Settings > Password & Security.

Access Key on TestMu AI Automation Dashboard

Windows

set LT_USERNAME="YOUR_LAMBDATEST_USERNAME"
set LT_ACCESS_KEY="YOUR_LAMBDATEST_ACCESS_KEY"

macOS/Linux

export LT_USERNAME="YOUR_LAMBDATEST_USERNAME"
export LT_ACCESS_KEY="YOUR_LAMBDATEST_ACCESS_KEY"

Language-Specific Setup

Install the Playwright package:

npm install playwright

Run Your First Test


playwright-ios-test.js
const { webkit } = require("playwright");

(async () => {
const capabilities = {
"LT:Options": {
"platformName": "ios",
"deviceName": "iPhone 16",
"platformVersion": "18",
"isRealMobile": true,
"build": "Playwright iOS Build",
"name": "Playwright iOS Test",
"user": process.env.LT_USERNAME,
"accessKey": process.env.LT_ACCESS_KEY,
"network": true,
"video": true,
"console": true,
},
};

const browser = await webkit.connect(
`wss://cdp.lambdatest.com/playwright?capabilities=${encodeURIComponent(
JSON.stringify(capabilities)
)}`
);

const context = await browser.newContext();
const page = await context.newPage();

await page.goto("https://duckduckgo.com", { timeout: 30000 });
await page.locator('[name="q"]').fill("LambdaTest");
await page.locator('[name="q"]').press("Enter");
await page.waitForTimeout(3000);

const title = await page.title();
console.log("Page title:", title);

try {
if (title.includes("LambdaTest")) {
await page.evaluate(
(_) => {},
`lambdatest_action: ${JSON.stringify({
action: "setTestStatus",
arguments: { status: "passed", remark: "Title verified" },
})}`
);
}
} catch (e) {
await page.evaluate(
(_) => {},
`lambdatest_action: ${JSON.stringify({
action: "setTestStatus",
arguments: { status: "failed", remark: e.message },
})}`
);
}

await page.close();
await context.close();
await browser.close();
})();

Run the test:

node playwright-ios-test.js

View your Playwright test results


The TestMu AI Automation Dashboard is where you can see the results of your Playwright iOS tests after running them on the TestMu AI platform.

The below screenshot of TestMu AI Automation Dashboard shows the Playwright build on the left and the build sessions associated with the selected build on the right.

Playwright iOS build and session details on TestMu AI Automation Dashboard
note
  • Safari is the supported browser for iOS real device testing. All four languages — Node.js, Java, C#, and Python — are supported using stock Playwright packages.

  • Playwright testing on real iOS devices is currently supported on latest iOS versions (iOS 17, iOS 18, and iOS 26) across both iPhones and iPads.

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

Book Demo

Help and Support

Related Articles