# Web Inspector

Open Safari's Web Inspector on a Safari tab or your app's web view, on an iPhone, iPad or iOS Simulator, right from Device MCP. Your AI agent can measure web pages too.

Device MCP opens Safari's Web Inspector on a web page on your iPhone, iPad or iOS Simulator: a Safari tab, or a web view in your app. It's the same inspector as Safari's **Develop** menu, with Elements, Console, Network, Sources and the rest, right next to the mirror.

## 1. Before you start

* **iPhone and iPad**: turn on **Settings › Apps › Safari › Advanced › Web Inspector** on the device. It's off until you do; Device MCP shows you the steps when it is.
* **iOS Simulator**: nothing to turn on.
* **Your app**: its web views are listed while it runs, if it sets `isInspectable` on them (iOS 16.4 and later):

```swift
webView.isInspectable = true
```

## 2. Open the Web Inspector

1. Click **…** under the mirror and choose **Inspect Web Views…**. It's also in the menu bar: **Device › Inspect Web Views…**.
2. The **Web Views** window lists the device's web views by app, with their titles and addresses.
3. Click **Inspect** next to one. The Web Inspector opens in a window of its own, and the button then reads **Show**.

## 3. Inspect the page

* **Select a tag** in Elements: the device highlights its element, and the sidebar shows its styles.
* **Pick an element on the screen**: click the target at the top left of the inspector (<kbd>⇧⌘C</kbd>), then click the element in the mirror. The tree opens down to it.
* **Console, Network, Sources and Storage** work as they do in Safari.

{% hint style="info" %}
Only one inspector can attach to a page at a time. If Safari's Web Inspector on your Mac has the page open, close it first. When the page closes or its app quits, the window keeps the page as it last was, and its title says it's disconnected.
{% endhint %}

## 4. For AI agents

Your agent can find web views and measure them through [MCP](../ai-agents/mcp.md), without changing the page:

| Tool | What it does |
| --- | --- |
| `list_webviews` | Lists the web views it can inspect: id, app, title and address. |
| `inspect_webview_element` | Measures what a CSS selector matches: each element's box, inline style and computed styles. |
| `open_web_inspector` | Opens the Web Inspector window for you on a web view. |

### ✅ Example Prompts

* The sheet header in my app's web view looks too tall on the simulator. Measure it and tell me why.
* Open the Web Inspector on the Safari tab on my iPad.

The [command line](../command-line.md) has the same: `device-mcp-cli webviews`, `webviews inspect` and `webviews open`. Web views work on Device MCP Free and Pro, on iPhones, iPads and iOS Simulators.
