> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.com/vercel-labs/agent-browser/llms.txt
> Use this file to discover all available pages before exploring further.

# Inspection Commands

> Extract information and check element state

## Overview

Inspection commands allow you to extract information from elements and check their state.

## Get Element Information

### get text

Get text content of an element.

<table>
  <thead>
    <tr>
      <th>Parameter</th>
      <th>Description</th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td><code>selector</code></td>
      <td>Element selector</td>
    </tr>
  </tbody>
</table>

**Examples:**

```bash theme={null}
agent-browser get text @e1
agent-browser get text "#username"
agent-browser get text ".error-message"
```

**Output:**

```
Welcome to Example Domain
```

### get html

Get innerHTML of an element.

<table>
  <thead>
    <tr>
      <th>Parameter</th>
      <th>Description</th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td><code>selector</code></td>
      <td>Element selector</td>
    </tr>
  </tbody>
</table>

**Examples:**

```bash theme={null}
agent-browser get html @e2
agent-browser get html "#content"
```

**Output:**

```html theme={null}
<p>This is <strong>example</strong> content.</p>
```

### get value

Get value of an input element.

<table>
  <thead>
    <tr>
      <th>Parameter</th>
      <th>Description</th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td><code>selector</code></td>
      <td>Input element selector</td>
    </tr>
  </tbody>
</table>

**Examples:**

```bash theme={null}
agent-browser get value @e3
agent-browser get value "#email"
```

**Output:**

```
user@example.com
```

### get attr

Get attribute value of an element.

<table>
  <thead>
    <tr>
      <th>Parameter</th>
      <th>Description</th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td><code>selector</code></td>
      <td>Element selector</td>
    </tr>

    <tr>
      <td><code>attribute</code></td>
      <td>Attribute name</td>
    </tr>
  </tbody>
</table>

**Examples:**

```bash theme={null}
agent-browser get attr @e4 href
agent-browser get attr "#logo" src
agent-browser get attr "button" data-id
```

**Output:**

```
https://example.com/page
```

### get title

Get page title.

**Examples:**

```bash theme={null}
agent-browser get title
```

**Output:**

```
Example Domain
```

### get url

Get current page URL.

**Examples:**

```bash theme={null}
agent-browser get url
```

**Output:**

```
https://example.com/page
```

### get count

Count matching elements.

<table>
  <thead>
    <tr>
      <th>Parameter</th>
      <th>Description</th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td><code>selector</code></td>
      <td>Element selector</td>
    </tr>
  </tbody>
</table>

**Examples:**

```bash theme={null}
agent-browser get count ".item"
agent-browser get count "button"
```

**Output:**

```
5
```

### get box

Get bounding box of an element.

<table>
  <thead>
    <tr>
      <th>Parameter</th>
      <th>Description</th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td><code>selector</code></td>
      <td>Element selector</td>
    </tr>
  </tbody>
</table>

**Examples:**

```bash theme={null}
agent-browser get box @e1
agent-browser get box "#header"
```

**Output:**

```json theme={null}
{"x": 10, "y": 20, "width": 300, "height": 50}
```

### get styles

Get computed styles of an element.

<table>
  <thead>
    <tr>
      <th>Parameter</th>
      <th>Description</th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td><code>selector</code></td>
      <td>Element selector</td>
    </tr>
  </tbody>
</table>

**Examples:**

```bash theme={null}
agent-browser get styles @e2
agent-browser get styles ".button"
```

**Output:**

```json theme={null}
{"display": "block", "color": "rgb(0, 0, 0)", ...}
```

## Check Element State

### is visible

Check if element is visible.

<table>
  <thead>
    <tr>
      <th>Parameter</th>
      <th>Description</th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td><code>selector</code></td>
      <td>Element selector</td>
    </tr>
  </tbody>
</table>

**Examples:**

```bash theme={null}
agent-browser is visible @e1
agent-browser is visible "#modal"
```

**Output:**

```
true
```

### is enabled

Check if element is enabled.

<table>
  <thead>
    <tr>
      <th>Parameter</th>
      <th>Description</th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td><code>selector</code></td>
      <td>Element selector</td>
    </tr>
  </tbody>
</table>

**Examples:**

```bash theme={null}
agent-browser is enabled @e2
agent-browser is enabled "#submit-button"
```

**Output:**

```
false
```

### is checked

Check if checkbox or radio is checked.

<table>
  <thead>
    <tr>
      <th>Parameter</th>
      <th>Description</th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td><code>selector</code></td>
      <td>Checkbox/radio selector</td>
    </tr>
  </tbody>
</table>

**Examples:**

```bash theme={null}
agent-browser is checked @e3
agent-browser is checked "#agree-terms"
```

**Output:**

```
true
```

## Workflow Examples

### Verify Form Submission

```bash theme={null}
# Submit form
agent-browser click @e5

# Wait for success message
agent-browser wait @e6

# Verify message text
agent-browser get text @e6
# Output: "Form submitted successfully"

# Verify URL changed
agent-browser get url
# Output: https://example.com/success
```

### Extract Data

```bash theme={null}
# Get page title
agent-browser get title

# Count all links
agent-browser get count "a"

# Extract all product names
agent-browser get text ".product-name"

# Get current URL
agent-browser get url
```

### Conditional Logic

```bash theme={null}
# Check if error is visible
agent-browser is visible ".error"

# If visible, get error message
agent-browser get text ".error"

# Check if button is enabled
agent-browser is enabled "#submit"

# Check if checkbox is checked
agent-browser is checked "#newsletter"
```

### JSON Output for Agents

```bash theme={null}
# Get text in JSON format
agent-browser get text @e1 --json
# {"success":true,"data":"Welcome to Example Domain"}

# Check visibility in JSON format
agent-browser is visible @e2 --json
# {"success":true,"data":true}

# Get count in JSON format
agent-browser get count ".item" --json
# {"success":true,"data":5}
```
