October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PCOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
Cupertino desk5 min

How to Capture a Website Screenshot on an iPhone Simulator with Playwright

Capture an iPhone-style webpage with Playwright, understand how it differs from an actual iOS Simulator screenshot, and troubleshoot repeatable captures.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To capture a website as it would appear in an iPhone-sized browser, create a Playwright context from an iPhone device preset, open the page, and save it with page.screenshot(). That emulates mobile browser settings; it does not capture a window running in Apple’s iOS Simulator. If you need the actual Simulator display, use the Simulator app or xcrun simctl instead.

Capture an iPhone-style webpage with Playwright

Install Playwright in a Node.js project, then use its device registry to configure the browser context. The preset supplies device-related settings such as viewport, screen size, user agent, and touch behavior. Playwright describes this as emulating a real device; the page still runs in a Playwright browser, not necessarily on iOS hardware or inside Apple’s Simulator. See the Playwright Emulation guide.

As an Amazon Associate I earn from qualifying purchases.

  1. Install Playwright and its browser binaries in your project. For example, run npm install playwright, then npx playwright install chromium.

    Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  2. Save the following as capture.js. It launches Chromium, applies the iPhone 13 preset, navigates to the target URL, and saves a full-page PNG.

    #1 Best Overall
    Apple iPhone 14, 128GB, Midnight - Unlocked (Renewed)
    • This phone is unlocked and compatible with any carrier of choice on GSM and CDMA networks (e.g. AT&T, T-Mobile, Sprint, Verizon, US Cellular, Cricket, Metro, Tracfone, Mint Mobile, etc.).
    • Please check with your carrier to verify compatibility.
    • The device does not come with headphones or a SIM card. It does include a generic (Mfi certified) charging cable.
    • Tested for battery health and guaranteed to have a minimum battery capacity of 80%.
  3. Run it with node capture.js. The screenshot is written to iphone-page.png in the current directory.

const { chromium, devices } = require('playwright');

(async () => {
  const browser = await chromium.launch();
  try {
    const context = await browser.newContext({
      ...devices['iPhone 13'],
    });
    const page = await context.newPage();
    await page.goto('https://example.com');
    await page.screenshot({ path: 'iphone-page.png', fullPage: true });
  } finally {
    await browser.close();
  }
})();

The iPhone 13 preset is shown in Playwright’s documentation, but device-registry entries can change. Check that your installed Playwright version includes the preset name you use. The try/finally ensures the browser is closed even if navigation or capture fails.

Choose Chromium or WebKit deliberately

The example uses Chromium. If you want to render in Playwright’s WebKit engine, switch the import and launch call. WebKit can help you check an engine that is closer to Safari’s rendering, but it is still a Playwright browser capture, not a screenshot of Safari running inside Apple’s Simulator. Playwright’s library documentation shows the browser launch and screenshot workflow: Playwright library.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
const { webkit, devices } = require('playwright');

(async () => {
  const browser = await webkit.launch();
  try {
    const context = await browser.newContext({ ...devices['iPhone 13'] });
    const page = await context.newPage();
    await page.goto('https://example.com');
    await page.screenshot({ path: 'iphone-webkit.png' });
  } finally {
    await browser.close();
  }
})();

Choose viewport or full-page output, and control image scale

page.screenshot() captures the current viewport by default. Set fullPage: true to capture the full scrollable page, as in the first script. A full-page image is useful for reviewing a long page in one file; a viewport image better represents what is visible on the emulated screen at one time.

Rank #2
Apple iPhone 16, 128GB, Pink - Unlocked (Renewed)
  • 6.1" Super Retina XDR OLED, HDR10, Dolby Vision, 1000nits (typ), 2000nits (HBM), 2556x1179px at 460ppi, 3561mAh Battery
  • 128GB 8GB RAM, Apple A18 (3nm), Hexa-core (2x4.04 GHz + 4x2.20 GHz), Apple GPU 5-core, 16‑core Neural Engine
  • Rear camera: 48MP, f/1.6, wide + 12MP, f/2.2, ultrawide, Front Camera: 12MP, f/1.9, wide, iOS 18, upgradable to iOS 18.5
  • 4G LTE: 1/2/3/4/5/7/8/12/13/14/17/18/19/20/25/26/28/29/30/32/34/38/39/40/41/42/48/53/66/71, 5G: n1/2/3/5/7/8/12/14/20/25/26/28/29/30/38/40/41/48/53/66/70/71/75/76/77/78/79 - Dual eSIM
  • Unlocked for freedom to choose your carrier. Compatible with both GSM & CDMA networks. The phone is unlocked to work with all GSM Carriers & CDMA Carriers Including AT&T, T-Mobile, Verizon, Sprint., Etc.

Playwright can infer the image format from the filename extension or take an explicit supported type. The screenshot API also supports an output path, JPEG quality, masks, transparent backgrounds for applicable image types, and a stylesheet for hiding or stabilizing page elements. Consult the current screenshot API reference for exact option names and availability in your installed version.

The scale setting controls output pixel dimensions. Use css for one image pixel per CSS pixel; use device for device pixels, which can produce a larger, higher-resolution image. Choose based on whether you need a compact review image or an output that preserves the emulated device pixel density.

Capture the actual Apple iOS Simulator screen

If the website is already open in an iOS Simulator and the image must show that simulator’s display, capture the Simulator rather than creating a Playwright device-emulation context. In Terminal, the documented command is:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
xcrun simctl io booted screenshot simulator-screen.png

This saves a screenshot of the booted simulator display to the named file in the current directory. Apple’s cited Simulator guide is archived and marked retired, so confirm the syntax and behavior for your installed Xcode setup with Simulator Help or xcrun simctl io help. The command captures the display; it does not navigate to a website or automate Safari.

Rank #3
Apple iPhone 15, 128GB, Black - Unlocked (Renewed)
  • 6.1inch Super Retina XDR display. Aluminum with color-infused glass back. Ring/Silent switch
  • Dynamic Island. A magical way to interact with iPhone. A16 Bionic chip with 5-core GPU
  • Advanced dual-camera system. 48MP Main | Ultra Wide. Super-high-resolution photos (24MP and 48MP). Next-generation portraits with Focus and Depth Control. 4X optical zoom range
  • Emergency SOS via satellite. Crash Detection. Roadside Assistance via satellite
  • Up to 26 hours video playback. USB C, Supports USB 2. Face ID
Need Use What the image represents
Automated browser capture with iPhone-like viewport and device settings Playwright context with an iPhone preset and page.screenshot() A webpage rendered in a Playwright browser configured for device emulation
Image of a page already displayed in Apple’s iOS Simulator Simulator screenshot UI or xcrun simctl io booted screenshot The booted simulated device’s screen

The available official documentation does not establish a standard Playwright workflow that drives Safari inside Apple’s Simulator. Treat device emulation and Simulator screen capture as separate methods unless you have verified a setup-specific integration.

Make captures repeatable for visual checks

For one-off output, call page.screenshot(). For visual regression testing, Playwright Test provides expect(page).toHaveScreenshot(). The assertion waits for two consecutive screenshots to match before comparing against the stored expectation, and it requires the Playwright test runner. See the visual comparisons documentation and screenshot assertion reference.

Keep baseline generation and comparison in the same environment where possible. Playwright warns that rendering can vary with the host operating system, browser version, settings, hardware, power source, and headless mode. Dynamic content can also change between runs; use the screenshot API’s stylesheet controls to hide or stabilize volatile page elements when appropriate. See Playwright’s visual comparison guidance.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Troubleshoot common capture problems

  • The device preset is undefined: verify the spelling and capitalization of devices['iPhone 13'] and confirm your installed Playwright release includes that registry entry. Update the package or choose an available preset from the current Emulation guide.

    Rank #4
    Apple iPhone 13, 128GB, Midnight - Unlocked (Renewed)
    • This pre-owned product is not Apple certified, but has been professionally inspected, tested and cleaned by Amazon-qualified suppliers.
    • There will be no visible cosmetic imperfections when held at an arm’s length.
    • This product is eligible for a replacement or refund within 90 days of receipt if you are not satisfied.
    • Product may come in generic Box.
  • The browser fails to launch: install the browser binary for the engine you selected. For Chromium, run npx playwright install chromium from the project. If using WebKit, install the corresponding browser binary instead.

  • The image contains only the first screen: this is the default viewport capture. Set fullPage: true if you need the full scrollable page.

  • The screenshot differs across machines: run baseline creation and comparison with the same browser and host environment where possible, and stabilize dynamic content. Operating system, browser version, settings, hardware, power source, and headless mode can affect rendering.

    Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • xcrun simctl cannot capture a screen: ensure a simulator is booted and check xcrun simctl io help or the installed Simulator Help. Apple’s cited guide is retired, so its release-specific details may not match your Xcode installation.

    Best Value
    Apple iPhone 16e, 128GB, Black - Unlocked (Renewed)
    • 6.1" Super Retina XDR OLED, HDR10, 800 nits (HBM), 1200 nits (peak), 2532x1170px at 460ppi, 4005mAh Battery
    • 8GB RAM, Apple A18 6-core CPU (2 performance + 4 efficiency cores), Apple GPU 4-core, 16‑core Neural Engine
    • Rear camera: 48MP, f/1.6, wide, Front Camera: 12MP, f/1.9, wide, iOS 18.3.1, upgradable to iOS 18.5
    • Connectivity: Global 4G LTE, Sub-6 GHz 5G, LTE, Wi-Fi 6, Bluetooth 5.3, NFC, USB-C, Wireless Charging (7.5W). (does not have mmWave 5G or MagSafe or physical SIM card) - Dual eSIM Only
    • Unlocked for freedom to choose your carrier. Compatible with both GSM & CDMA networks. The phone is unlocked to work with all GSM Carriers & CDMA Carriers Including AT&T, T-Mobile, Verizon, Straight Talk., Etc.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

ScreenshotNeo can return a website screenshot through one GET request. It accepts consent banners like a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each cleanup step can be turned off. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers identify the page verdict and billing status. It also provides an MCP server for AI agents, with take_screenshot, get_page_info, and capture_pdf tools.

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com -o shot.webp

See the ScreenshotNeo API documentation for the API options. Free includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000. ScreenshotNeo is an API alternative when you want to request captures without installing a browser locally. Sign up for free: 1,000 screenshots a month, no card required.

Frequently Asked Questions

Does Playwright’s iPhone preset run the page in Apple’s iOS Simulator?

No. It configures device-related browser settings in Playwright; use Simulator’s screenshot feature or simctl to capture the actual simulated display.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Can I save the Playwright screenshot as JPEG instead of PNG?

Yes. Use a JPEG filename extension or set a supported image type explicitly, and consult the screenshot API reference for the options supported by your installed version.

Quick Recap

Bestseller No. 1
Apple iPhone 14, 128GB, Midnight - Unlocked (Renewed)
Apple iPhone 14, 128GB, Midnight - Unlocked (Renewed)
Please check with your carrier to verify compatibility.; Tested for battery health and guaranteed to have a minimum battery capacity of 80%.
$300.00
Bestseller No. 3
Apple iPhone 15, 128GB, Black - Unlocked (Renewed)
Apple iPhone 15, 128GB, Black - Unlocked (Renewed)
Dynamic Island. A magical way to interact with iPhone. A16 Bionic chip with 5-core GPU; Emergency SOS via satellite. Crash Detection. Roadside Assistance via satellite
$405.00
Bestseller No. 4
Apple iPhone 13, 128GB, Midnight - Unlocked (Renewed)
Apple iPhone 13, 128GB, Midnight - Unlocked (Renewed)
There will be no visible cosmetic imperfections when held at an arm’s length.; Product may come in generic Box.
$262.00

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.