---
title: 'Playwright on Real iPhones & iPads: Mobile Safari Testing'
description: Your Playwright tests can now run in Safari on real iPhones and iPads
  (iOS 17+) and on iOS 18+ simulators. Same client, webkit.connect(), one capability
  change.
source_url:
  html: https://testingbot.com/blog/playwright-ios-real-device-testing
  md: https://testingbot.com/blog/playwright-ios-real-device-testing.md
---

# Playwright now runs on real iPhones and iPads

Your Playwright tests can now run in Safari on real iPhones and iPads (iOS 17+) and on iOS 18+ simulators. Same client, webkit.connect(), one capability change.

By [Jochen D.](https://testingbot.com/about/jochen-d)2026-11-30

 Share on Facebook 

 Share on Twitter 

 Post on Reddit 

 Share link 

Since last week you can point your [Playwright tests](https://testingbot.com/features/automation/playwright) at Safari on a real iPhone or iPad in our device cloud. Simulators work as well. You keep the Playwright client you already have, call `webkit.connect()` instead of `chromium.connect()`, and ask for an iPhone in the capabilities.

This has been one of the most requested features since we added Playwright. Playwright's own answer to mobile Safari is emulation: `devices['iPhone 15']` gives a desktop browser the screen size, user agent and touch support of an iPhone. The WebKit it downloads is a build for macOS, Linux and Windows. Both are useful, and neither is the Safari your visitors use on their phones. Fixed headers that jump when the address bar collapses, inputs that zoom the page when focused, a checkout button hidden behind the on-screen keyboard: you only see these in Mobile Safari.

## A first test

Install Playwright 1.62 or newer (up to 1.65, more on that below) and run this:

```bash
npm i playwright-core@1.63.0
```

```javascript
const { webkit } = require('playwright-core')

;(async () => {
  const capabilities = {
    browserName: 'safari',
    platformName: 'iOS',
    deviceName: 'iPhone.*',
    browserVersion: '>=17',
    realDevice: true,
    name: 'Homepage on iPhone',
    build: 'build-42',
    key: process.env.TB_KEY,
    secret: process.env.TB_SECRET
  }

  const browser = await webkit.connect(
    `wss://cloud.testingbot.com/playwright?capabilities=${encodeURIComponent(JSON.stringify(capabilities))}`
  )
  try {
    const context = await browser.newContext()
    const page = await context.newPage()
    await page.goto('https://testingbot.com/')
    console.log(await page.title())
    await page.screenshot({ path: 'iphone.png', fullPage: true })
  } finally {
    await browser.close()
  }
})()
```

`deviceName` is a regular expression, so `'iPhone.*'` means "any free iPhone". That is usually what you want in CI: you don't wait for one particular phone to become available. Keep `browserVersion: '>=17'` next to it. Some of our older iPhones still run iOS 14 to 16, which Playwright can't drive, and the version filter keeps the wildcard away from them. A plain major version such as `'26'` works too if you want one iOS release.

When we ran this example while writing this post, the connection was up after 4 seconds, on an iPhone with Safari 27. Need a specific model? Use its name instead, for example `'iPhone 17 Pro'`, or `'iPad.*'` for any iPad. The device picker on the [Playwright on iOS docs page](https://testingbot.com/support/web-automate/playwright/ios#devices) lists every device you can choose.

Afterwards the session is in your dashboard like any other test: a video of the screen, the logs, and the name and build from the capabilities.

The same thing in Python:

```python
import json, os
from urllib.parse import quote
from playwright.sync_api import sync_playwright

capabilities = {
    "browserName": "safari",
    "platformName": "iOS",
    "deviceName": "iPhone.*",
    "browserVersion": ">=17",
    "realDevice": True,
    "key": os.environ["TB_KEY"],
    "secret": os.environ["TB_SECRET"],
}
ws_url = "wss://cloud.testingbot.com/playwright?capabilities=" + quote(json.dumps(capabilities))

with sync_playwright() as playwright:
    browser = playwright.webkit.connect(ws_url, timeout=180000)
    try:
        page = browser.new_context().new_page()
        page.goto("https://testingbot.com/")
        print(page.title())
    finally:
        browser.close()
```

Java and .NET work the same way: use the binding's `webkit` browser type and connect to the same URL.

## Simulators

Remove `realDevice: true` and the same code runs in Safari on an iOS simulator:

```javascript
const capabilities = {
  browserName: 'safari',
  platformName: 'iOS',
  deviceName: 'iPhone.*',
  browserVersion: '>=18',
  key: process.env.TB_KEY,
  secret: process.env.TB_SECRET
}
```

Simulators need iOS 18 or newer, hence `'>=18'` here. On iOS 17 simulators Safari was too unreliable under Playwright in our tests, so we turn those sessions away up front. A simulator sometimes has to boot first. Our test run connected after 15 seconds, but give the connect call a few minutes before it times out.

Two things only work on real devices. One is real hardware performance. The other is trusted input, which we'll get to in a moment. For covering a wide range of iOS versions and screen sizes, simulators are the cheaper and faster option.

## What carries over from desktop, and what doesn't

Most of a typical test suite runs unchanged. Locators, `click()`, `fill()`, `selectOption()`, keyboard input, navigation, iframes and file uploads all work. So do screenshots of the viewport, the full page or one element. `page.route()` works for mocking and blocking requests, and so does `storageState` to [reuse a logged-in session](https://testingbot.com/support/web-automate/playwright/reuse-login-state). Geolocation, timezone and offline mode can be set on the context. Tracing works too, minus the screenshot filmstrip.

Some things are different because Safari on a phone isn't a desktop browser:

- You get one browser context at a time, with one page in it. You can open contexts one after another, and tabs the page opens itself (popups) work. Wait for those with `context.waitForEvent('page')`, because `page.waitForEvent('popup')` doesn't fire on iOS.
- The viewport is the phone's screen. `setViewportSize()` and the `viewport` option do nothing.
- Downloads, `page.pdf()`, `recordVideo` and CDP sessions aren't available. We record a video of every session anyway.

The [docs](https://testingbot.com/support/web-automate/playwright/ios#limits) have the full list.

## Real taps for payment forms and bot checks

By default, Playwright's clicks and key presses are generated inside the page. That's quick, but the browser marks those events with `isTrusted: false`, and some payment fields and anti-bot widgets ignore them. On a real device you can set `nativeInput: true`. We then send actual taps and key presses through the iPhone, and the page sees trusted events.

```javascript
const capabilities = {
  browserName: 'safari',
  platformName: 'iOS',
  deviceName: 'iPhone.*',
  browserVersion: '>=17',
  realDevice: true,
  nativeInput: true,
  key: process.env.TB_KEY,
  secret: process.env.TB_SECRET
}
```

A native tap takes about half a second, so we'd keep this to the tests that need it and leave it off for the rest of the suite.

## Why only Playwright 1.62 to 1.65?

A Playwright server only accepts clients of its own minor version. So on the device side we run the playwright-core version that matches yours, and 1.62 is the first release whose WebKit support works with stock Safari. We add newer versions after we've tested them on the device fleet. Until then, a session from a newer client is refused straight away. You don't wait for a device only to get an error.

Real devices need iOS 17 or newer. For Safari on older iPhones, [Appium](https://testingbot.com/support/web-automate/mobile) still covers you.

## Testing a staging or local site

[TestingBot Tunnel](https://testingbot.com/support/tunnel) works the same as with desktop browsers, with one catch. iOS won't reach `localhost` or `127.0.0.1` through the tunnel, so give your machine another hostname, for example in your hosts file, and use that in `page.goto()`.

## Common questions

### Can Playwright test Safari on a real iPhone?

On TestingBot, yes. Connect with `webkit.connect()` to `wss://cloud.testingbot.com/playwright`. Set `browserName: 'safari'`, `platformName: 'iOS'` and `realDevice: true`, plus a `deviceName` such as `'iPhone.*'`. The test runs in the Safari app on a physical iPhone with iOS 17 or newer.

### Do I need a Mac?

No. The phones, simulators and Safari are on our side. Your tests run wherever they run now, on Linux, Windows or macOS, locally or in CI.

### And Android?

Chrome on real Android devices has been supported for a while: see [Playwright on Android devices](https://testingbot.com/support/web-automate/playwright/mobile).

The [Playwright on iOS documentation](https://testingbot.com/support/web-automate/playwright/ios) has the device picker, every capability and a troubleshooting section. If something in your suite doesn't behave on iOS the way it does on desktop, tell us. That kind of report is how the list of what works got this long.

[Start a free trial](https://testingbot.com/users/sign_up) [Playwright on iOS docs](https://testingbot.com/support/web-automate/playwright/ios)

[← Previous post Announcing AI Test Insights](https://testingbot.com/blog/ai-test-insights)

## Sidebar

### TestingBot Cloud Testing

Run automated, manual and visual tests on remote browsers and devices. Sign up for a free trial.

[Free Trial](https://testingbot.com/users/sign_up)

### Latest articles

[![Playwright on Real iPhones & iPads: Mobile Safari Testing](https://testingbot.com/assets/blog/2026/playwright-ios.jpg)](https://testingbot.com/blog/playwright-ios-real-device-testing)

#### Playwright on Real iPhones & iPads: Mobile Safari Testing

Your Playwright tests can now run in Safari on real iPhon...

[Read: Playwright on Real iPhones & iPads: Mobile Safari Testing](https://testingbot.com/blog/playwright-ios-real-device-testing)

[![Announcing AI Test Insights](https://testingbot.com/assets/blog/2026/ai-insights.jpg)](https://testingbot.com/blog/ai-test-insights)

#### Announcing AI Test Insights

Use AI Insights to quickly discover why an automated test...

[Read: Announcing AI Test Insights](https://testingbot.com/blog/ai-test-insights)

[![Selenium vs Playwright 2026](https://testingbot.com/assets/blog/2026/selenium-vs-playwright-2026.jpg)](https://testingbot.com/blog/selenium-vs-playwright)

#### Selenium vs Playwright 2026

Comparing Selenium vs Playwright - which is the best test...

[Read: Selenium vs Playwright 2026](https://testingbot.com/blog/selenium-vs-playwright)

## Related Articles

[![Selenium vs Playwright 2026](https://testingbot.com/assets/blog/2026/selenium-vs-playwright-2026.jpg)](https://testingbot.com/blog/selenium-vs-playwright "Selenium vs Playwright 2026")

### [Selenium vs Playwright 2026](https://testingbot.com/blog/selenium-vs-playwright)

Comparing Selenium vs Playwright - which is the best test framework for your usecase?

[Read article →](https://testingbot.com/blog/selenium-vs-playwright)

[![Selenium 20th birthday](https://testingbot.com/assets/blog/2024/selenium20.webp)](https://testingbot.com/blog/selenium-20-years "Selenium 20th birthday")

### [Selenium 20th birthday](https://testingbot.com/blog/selenium-20-years)

Celebrate Selenium's 20th birthday. An overview of the years.

[Read article →](https://testingbot.com/blog/selenium-20-years)

[![Playwright Testing on TestingBot](https://testingbot.com/assets/blog/2023/playwright-testing.jpg)](https://testingbot.com/blog/playwright-testing-introduction "Playwright Testing on TestingBot")

### [Playwright Testing on TestingBot](https://testingbot.com/blog/playwright-testing-introduction)

Learn how Playwright can run your automated tests on a variety of browsers, local or remote browsers on TestingBot.

[Read article →](https://testingbot.com/blog/playwright-testing-introduction)

[![February 2023 Product Updates](https://testingbot.com/assets/blog/2023/feb_prod_update.jpg)](https://testingbot.com/blog/february-2023-updates "February 2023 Product Updates")

### [February 2023 Product Updates](https://testingbot.com/blog/february-2023-updates)

An overview of the exciting new features released on TestingBot in February.

[Read article →](https://testingbot.com/blog/february-2023-updates)

## More by Jochen D.

[![Announcing AI Test Insights](https://testingbot.com/assets/blog/2026/ai-insights.jpg)](https://testingbot.com/blog/ai-test-insights "Announcing AI Test Insights")
### [Announcing AI Test Insights](https://testingbot.com/blog/ai-test-insights)

Use AI Insights to quickly discover why an automated test failed.

[![Maestro Physical Device Testing](https://testingbot.com/assets/blog/2026/maestro-physical.jpg)](https://testingbot.com/blog/maestro-physical-device-testing "Maestro Physical Device Testing")
### [Maestro Physical Device Testing](https://testingbot.com/blog/maestro-physical-device-testing)

Maestro testing in parallel on physical Android and iOS devices.

[![tvOS Physical Device Testing](https://testingbot.com/assets/blog/2025/appletv.jpg)](https://testingbot.com/blog/tvos-automated-testing "tvOS Physical Device Testing")
### [tvOS Physical Device Testing](https://testingbot.com/blog/tvos-automated-testing)

Run automated tvOS tests on physical AppleTV devices.

[See all posts by Jochen D. →](https://testingbot.com/about/jochen-d)

## Ready to start testing?
[Start a free trial](https://testingbot.com/users/sign_up)
