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

# Interaction Commands

> Click, type, hover, scroll, and interact with page elements

## Overview

Interaction commands allow you to simulate user interactions with page elements.

## Mouse Interactions

### click

Click an element.

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

  <tbody>
    <tr>
      <td><code>selector</code></td>
      <td>CSS selector, ref (@e1), or text locator</td>
    </tr>
  </tbody>
</table>

**Options:**

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

  <tbody>
    <tr>
      <td><code>--new-tab</code></td>
      <td>Open link in new tab</td>
    </tr>
  </tbody>
</table>

**Examples:**

```bash theme={null}
# Click by ref
agent-browser click @e2

# Click by CSS selector
agent-browser click "#submit-button"

# Click by text
agent-browser click "text=Sign In"

# Click and open in new tab
agent-browser click @e5 --new-tab
```

### dblclick

Double-click 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 dblclick @e3
agent-browser dblclick ".file-name"
```

### hover

Hover over 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 hover @e4
agent-browser hover ".dropdown-trigger"
```

### focus

Focus 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 focus @e1
agent-browser focus "#email-input"
```

## Text Input

### fill

Clear and fill an input field.

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

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

    <tr>
      <td><code>text</code></td>
      <td>Text to fill (multiple words joined with spaces)</td>
    </tr>
  </tbody>
</table>

**Examples:**

```bash theme={null}
# Fill by ref
agent-browser fill @e3 "test@example.com"

# Fill by selector
agent-browser fill "#email" "user@domain.com"

# Fill with multiple words
agent-browser fill @e2 "John Doe"
```

### type

Type text into an element (without clearing).

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

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

    <tr>
      <td><code>text</code></td>
      <td>Text to type</td>
    </tr>
  </tbody>
</table>

**Examples:**

```bash theme={null}
agent-browser type @e1 "additional text"
agent-browser type "#search" "query"
```

### press

Press a keyboard key.

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

  <tbody>
    <tr>
      <td><code>key</code></td>
      <td>Key name (Enter, Tab, Escape) or key combination (Control+a)</td>
    </tr>
  </tbody>
</table>

**Alias:** `key`

**Examples:**

```bash theme={null}
# Press Enter
agent-browser press Enter

# Press Tab
agent-browser press Tab

# Keyboard shortcuts
agent-browser press Control+a
agent-browser press Meta+v
```

### keyboard type

Type text with real keystrokes (current focus).

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

  <tbody>
    <tr>
      <td><code>text</code></td>
      <td>Text to type</td>
    </tr>
  </tbody>
</table>

**Examples:**

```bash theme={null}
agent-browser keyboard type "Hello World"
```

### keyboard inserttext

Insert text without key events (current focus).

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

  <tbody>
    <tr>
      <td><code>text</code></td>
      <td>Text to insert</td>
    </tr>
  </tbody>
</table>

**Examples:**

```bash theme={null}
agent-browser keyboard inserttext "pasted content"
```

## Form Controls

### check

Check a checkbox.

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

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

**Examples:**

```bash theme={null}
agent-browser check @e5
agent-browser check "#agree-terms"
```

### uncheck

Uncheck a checkbox.

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

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

**Examples:**

```bash theme={null}
agent-browser uncheck @e6
agent-browser uncheck "#newsletter"
```

### select

Select dropdown option(s).

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

  <tbody>
    <tr>
      <td><code>selector</code></td>
      <td>Select element selector</td>
    </tr>

    <tr>
      <td><code>value</code></td>
      <td>Option value(s) to select</td>
    </tr>
  </tbody>
</table>

**Examples:**

```bash theme={null}
# Select single option
agent-browser select @e4 "option1"

# Select multiple options
agent-browser select "#country" "US" "CA"
```

## Scrolling

### scroll

Scroll the page or an element.

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

  <tbody>
    <tr>
      <td><code>direction</code></td>
      <td>Direction: up, down, left, right (default: down)</td>
    </tr>

    <tr>
      <td><code>amount</code></td>
      <td>Pixels to scroll (default: 300)</td>
    </tr>
  </tbody>
</table>

**Options:**

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

  <tbody>
    <tr>
      <td><code>-s, --selector</code></td>
      <td>Scroll specific element instead of page</td>
    </tr>
  </tbody>
</table>

**Examples:**

```bash theme={null}
# Scroll down 300px (default)
agent-browser scroll

# Scroll down 500px
agent-browser scroll down 500

# Scroll up
agent-browser scroll up

# Scroll specific element
agent-browser scroll down 200 --selector "#content"
```

### scrollintoview

Scroll element into view.

<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>

**Alias:** `scrollinto`

**Examples:**

```bash theme={null}
agent-browser scrollintoview @e10
agent-browser scrollinto "#footer"
```

## Drag and Drop

### drag

Drag an element to another element.

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

  <tbody>
    <tr>
      <td><code>source</code></td>
      <td>Source element selector</td>
    </tr>

    <tr>
      <td><code>target</code></td>
      <td>Target element selector</td>
    </tr>
  </tbody>
</table>

**Examples:**

```bash theme={null}
agent-browser drag @e1 @e2
agent-browser drag ".draggable" ".drop-zone"
```

## File Upload

### upload

Upload file(s) to an input element.

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

  <tbody>
    <tr>
      <td><code>selector</code></td>
      <td>File input selector</td>
    </tr>

    <tr>
      <td><code>files</code></td>
      <td>File path(s) to upload</td>
    </tr>
  </tbody>
</table>

**Examples:**

```bash theme={null}
# Upload single file
agent-browser upload @e7 "/path/to/file.pdf"

# Upload multiple files
agent-browser upload "#file-input" "/path/to/file1.jpg" "/path/to/file2.jpg"
```

## Workflow Examples

### Login Form

```bash theme={null}
agent-browser open example.com/login
agent-browser fill @e1 "user@example.com"
agent-browser fill @e2 "password123"
agent-browser check @e3  # Remember me
agent-browser click @e4  # Submit button
```

### Search and Navigate

```bash theme={null}
agent-browser open example.com
agent-browser fill @e1 "search query"
agent-browser press Enter
agent-browser wait --load networkidle
agent-browser click @e5  # First result
```

### Form with Dropdowns

```bash theme={null}
agent-browser fill @e1 "John Doe"
agent-browser select @e2 "United States"
agent-browser check @e3
agent-browser upload @e4 "/path/to/resume.pdf"
agent-browser click @e5
```
