Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run Scan×
Skip to content
World desk5 min

How to Capture Mobile Website Screenshots with Selenium on Safari

A mobile-sized macOS Safari window is not iPhone Safari. Learn the iOS WebDriver setup, Python screenshot step, platform limits, and an API alternative.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

It depends on what you mean by “mobile Safari.” Selenium’s SafariDriver controls Safari on macOS; setting a phone-sized viewport there checks responsive layout, but it does not capture a session running in iPhone Safari. For actual iOS Safari, use an iOS automation route: Selenium’s Safari guide directs iOS users to Appium, and WebKit also documents native Safari WebDriver sessions on a connected iOS device or Simulator. This guide shows the screenshot step for an iOS session and explains the desktop-Safari alternative.

Choose the Safari environment that matches your goal

Target What the screenshot represents Setup implications
Safari on macOS with a mobile-sized window or viewport A responsive-layout check in desktop Safari, not a screenshot from iPhone Safari. Use macOS SafariDriver; adjust the browser window or viewport as supported by that desktop workflow.
Safari in iOS Simulator An iOS Safari session running in a simulator. WebKit documents Simulator sessions for iOS 13 or later runtimes and a safari:useSimulator: true capability. Check installed runtimes and current tool support in your Apple development environment.
Safari on a physical iPhone or iPad A session on the connected iOS device. Requires a Mac host, device-side Remote Automation setup, a trusted connected device, and an unlocked device when starting the session.

Selenium’s Safari documentation points readers seeking iOS automation to Appium. WebKit separately documents native Safari WebDriver support on iOS. These are distinct automation routes; choose a client and setup supported by your installed versions rather than assuming a desktop webdriver.Safari() session launches an iPhone.

As an Amazon Associate I earn from qualifying purchases.

WebKit’s Brian Burg described the introduction in his 2019 article WebDriver is Coming to Safari in iOS 13: “Starting in iOS 13, Safari now includes native support for the W3C WebDriver standard.” That statement describes the historical introduction, not the current minimum support requirement.

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

Set up an iOS Safari WebDriver session

For a physical iPhone or iPad

  1. Use a Mac host with a sufficiently recent safaridriver.
  2. On the Mac, run safaridriver --enable if required by your setup.
  3. On the iOS device, enable Remote Automation in Safari’s Advanced settings.
  4. Connect and trust the device, and leave it unlocked when starting the WebDriver session.
  5. Configure your selected iOS automation route to identify the platform, for example with platformName: ios. The client and service configuration depend on the route and its version.

For iOS Simulator

WebKit documents Safari WebDriver sessions using iOS Simulator for iOS 13 or later runtimes, including the safari:useSimulator: true capability. The exact availability of runtimes and integration depends on the Apple development tools and automation client installed on your Mac.

#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%.

Navigate, wait for the page, and save a PNG

The following Python example is the screenshot portion of an iOS WebDriver workflow. It deliberately leaves creation of driver to the Appium or Apple SafariDriver route you configured: the session capabilities and service setup differ, and a desktop Safari constructor alone is not an iPhone session.

from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait

# Create `driver` using the iOS Safari automation route selected for your setup.
# For physical iOS Safari, configure a connected device and Mac-hosted driver.
# For simulator use, configure the supported simulator capability for that route.

driver.get("https://example.com")
WebDriverWait(driver, 20).until(
    lambda d: d.execute_script("return document.readyState") == "complete"
)
if not driver.save_screenshot("mobile-safari.png"):
    raise RuntimeError("Screenshot could not be saved")
driver.quit()

Selenium’s Python Safari API also documents get_screenshot_as_file(filename) and save_screenshot(filename); these save PNG output, and the API says the method returns False if it cannot save the file. Use a path writable by the process running the test.

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.

The document.readyState wait is only a starting point. It does not prove that lazy-loaded images, animations, application-specific requests, or other asynchronous content are ready. Add a wait for the specific element or state that must be visible in the image. For example, a page may need a product image to load or a loading indicator to disappear before the capture reflects the desired state.

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

iOS-specific limits that affect captures

WebKit documents restrictions in iOS Safari WebDriver sessions: Set Window Rect, Minimize Window, and Maximize Window commands are unsupported. The software keyboard is suppressed in WebDriver sessions. Consequently, do not base an iOS capture workflow on desktop window-resizing commands or expect the on-screen keyboard to appear normally. Set the target and viewport through capabilities supported by your chosen iOS route.

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

Troubleshooting common capture problems

  • The screenshot is from desktop Safari, not iPhone Safari. A macOS SafariDriver session remains a desktop browser session, even at a phone-sized viewport. Start an iOS session through Appium or a documented native iOS Safari WebDriver route.
  • The iOS session will not start. Check that the Mac has an appropriately recent safaridriver, enable it with safaridriver --enable if needed, turn on Remote Automation in iOS Safari’s Advanced settings, trust the connected device, and unlock it when initiating the session.
  • The Simulator capability is rejected or no simulator appears. Confirm that an iOS 13-or-later runtime is installed and that your selected client supports the documented safari:useSimulator: true capability. Simulator and client support can depend on the installed Apple tools and versions.
  • The screenshot is blank or missing page content. Waiting for document readiness may be insufficient. Wait for the relevant page element or application state, and check whether the content is lazy-loaded or asynchronous.
  • The save call reports failure. Selenium’s screenshot API returns False when it cannot save the file. Check the output path and write permissions, then retry with a writable filename.
  • A resize, minimize, maximize, or keyboard interaction fails. iOS WebDriver does not support the documented window-management commands listed above, and it suppresses the software keyboard. Change the workflow rather than treating these as ordinary desktop Safari controls.

Or skip the browser setup

If you need a website image without configuring a Mac-hosted iOS session, ScreenshotNeo provides a screenshot API and MCP server. A single GET request returns an image or PDF; it is not an iPhone Safari WebDriver session, so use iOS automation when the device-specific behavior itself is what you need to test.

cURL example, with the target URL adapted to your page:

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.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

See the ScreenshotNeo API documentation for request options. Cookie banners and consent overlays, newsletter popups, and chat widgets can be removed before capture; those steps 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. An MCP server provides take_screenshot, get_page_info, and capture_pdf tools for AI agents. The free plan includes 1,000 screenshots per month without a card; paid plans start at $5 for 3,000 shots.

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

Sign up free for 1,000 screenshots a month—no card required.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Frequently Asked Questions

Can Selenium take a screenshot of a website in iPhone Safari?

Yes, through an iOS Safari automation session; a desktop SafariDriver session with a mobile-sized viewport is not an iPhone session.

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.

Does Selenium’s Python screenshot method save a JPEG?

The documented Safari screenshot-saving methods produce PNG output.

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.

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

Leave a Reply

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

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

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
Crashes, No Sound, or Screen Glitches?Free driver scan
PC Slower Than It Used to Be?Free scan - under a minute

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.