Skip to content

pymobiledevice3 webinspector

Control Safari/WebViews (tabs, automation, JS shells, CDP). Requires Web Inspector and Remote Automation enabled on the device.

opened-tabs

Show all currently opened tabs.

 Opt-in: iOS >= 18: Settings -> Apps -> Safari -> Advanced -> Web Inspector

iOS < 18: Settings -> Safari -> Advanced -> Web Inspector

pymobiledevice3 webinspector opened-tabs [OPTIONS]

Options:

Option Description
-t, --timeout <float> Seconds to wait for WebInspector to respond. [default: 3.0]

Accepts the connection options: --rsd, --tunnel, --userspace, --mobdev2, --usbmux, --udid.

launch

Launch a specific URL in Safari.

 Opt-in (iOS >= 18): Settings -> Apps -> Safari -> Advanced -> Web Inspector Settings -> Apps -> Safari -> Advanced -> Remote Automation

Opt-in (iOS < 18): Settings -> Safari -> Advanced -> Web Inspector Settings -> Safari -> Advanced -> Remote Automation

pymobiledevice3 webinspector launch [OPTIONS] {url}

Arguments:

Argument Description
url [required]

Options:

Option Description
-t, --timeout <float> Seconds to wait for WebInspector to respond. [default: 3.0]

Accepts the connection options: --rsd, --tunnel, --userspace, --mobdev2, --usbmux, --udid.

shell

Create an IPython shell for interacting with a WebView.

 Opt-in (iOS >= 18): Settings -> Apps -> Safari -> Advanced -> Web Inspector Settings -> Apps -> Safari -> Advanced -> Remote Automation

Opt-in (iOS < 18): Settings -> Safari -> Advanced -> Web Inspector Settings -> Safari -> Advanced -> Remote Automation

pymobiledevice3 webinspector shell [OPTIONS]

Options:

Option Description
-t, --timeout <float> Seconds to wait for WebInspector to respond. [default: 3.0]

Accepts the connection options: --rsd, --tunnel, --userspace, --mobdev2, --usbmux, --udid.

js-shell

Create a javascript shell. This interpreter runs on your local machine, but evaluates each expression on the remote

 Opt-in: iOS >= 18: Settings -> Apps -> Safari -> Advanced -> Web Inspector iOS < 18: Settings -> Safari -> Advanced -> Web Inspector  for automation also enable: iOS >= 18: Settings -> Apps -> Safari -> Advanced -> Remote Automation iOS < 18: Settings -> Safari -> Advanced -> Remote Automation

pymobiledevice3 webinspector js-shell [OPTIONS]

Options:

Option Description
--url <str>
-t, --timeout <float> Seconds to wait for WebInspector to respond. [default: 10.0]
--automation / --no-automation Use remote automation (requires Remote Automation toggle). [default: no-automation]
--bundle-id <str> Target app bundle identifier. Inspector: filter open pages (omit for all). Automation: launch app (omit for Safari).
--console-enable / --no-console-enable Enable console events for Inspector mode. Cannot be combined with --automation.
--open-safari / --no-open-safari Open Safari before selecting a page. [default: no-open-safari]
--no-replayed-log Don't print the console history the page replays on attach (webinspector.console.replay).

Accepts the connection options: --rsd, --tunnel, --userspace, --mobdev2, --usbmux, --udid.

cdp

Start a CDP server for debugging WebViews.

 Open the following URL in Google Chrome and pick a page to inspect: http://127.0.0.1:9222/

 Chrome-compatible debugger clients can attach through the browser-level endpoint advertised by /json/version. For VS Code, use a launch.json configuration such as: {"type": "chrome", "request": "attach", "address": "127.0.0.1", "port": 9222, "urlFilter": "*", "webRoot": "${workspaceFolder}"}

 Prefer this over chrome://inspect: chrome://inspect routes the DevTools frontend through Chrome's browser-process relay (network target), which deadlocks under sustained console traffic and freezes the console/screen. The URL above serves the DevTools frontend so it connects to this bridge directly, bypassing that relay.

 The frontend is fetched from the hosted build; when that is unreachable (offline), it is served from a local Chrome instead. Pass --chrome if Chrome is not on PATH or in a default install location.

pymobiledevice3 webinspector cdp [OPTIONS]

Options:

Option Description
--host <str> [default: 127.0.0.1]
--port <int> [default: 9222]
--chrome <str>

Accepts the connection options: --rsd, --tunnel, --userspace, --mobdev2, --usbmux, --udid.