> ## Documentation Index
> Fetch the complete documentation index at: https://docs.bringits.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Browser Commands

> Browser automation commands for web browser automation (Chrome, Firefox, etc.)

Browser commands enable you to automate web browser interactions including opening pages, clicking elements, filling forms, and extracting content. These commands are essential for web scraping and browser-based automation workflows.

## Overview

Browser commands provide functionality for:

* Opening and navigating web pages
* Interacting with DOM elements (clicks, inputs, scrolling)
* Extracting text content and attributes
* Managing browser sessions
* Handling dynamic content and JavaScript-rendered pages

## Available Commands

<CardGroup cols={2}>
  <Card title="Browser Open" icon="browser" href="/stream/commands/browser/browser-open">
    Open a browser session and navigate to a URL
  </Card>

  <Card title="Get Text Contents" icon="browser" href="/stream/commands/browser/get-text-contents">
    Extract text content from DOM elements
  </Card>

  <Card title="Get Attributes" icon="browser" href="/stream/commands/browser/get-attributes">
    Extract attributes from DOM elements
  </Card>
</CardGroup>

## Common Use Cases

* **Web Scraping**: Extract content from web pages
* **Form Automation**: Automate form filling and submission
* **Dynamic Content**: Handle JavaScript-rendered content
* **Multi-Page Navigation**: Navigate through multiple pages
* **Content Extraction**: Extract text, links, and attributes from pages

## Session Management

Browser commands support session management for maintaining state across commands:

```json theme={null}
{
  "command": "browser-open",
  "params": {
    "sessionId": "#{UUID}",
    "url": "https://example.com"
  }
}
```

## Command Parameters

Browser commands typically support the following parameters:

| Parameter           | Type   | Description                              | Required                       |
| ------------------- | ------ | ---------------------------------------- | ------------------------------ |
| **sessionId**       | string | Session identifier for maintaining state | No                             |
| **url**             | string | URL to navigate to                       | Yes (for browser-open)         |
| **selector**        | string | CSS selector for element targeting       | Yes (for interaction commands) |
| **timeout**         | number | Maximum wait time in milliseconds        | No                             |
| **elementsLocator** | object | Element locator configuration            | Yes (for extraction commands)  |

## Element Locators

Browser commands use element locators to target specific DOM elements:

### CSS Selectors

```json theme={null}
{
  "elementsLocator": {
    "selector": ".article-title",
    "timeout": 10000
  }
}
```

### Advanced Locator Features

* **Filtering**: Filter by innerText, hasChildren, or index
* **Chained Locators**: Use `continueWith` for nested searches
* **Multiple Elements**: Returns arrays for multiple matching elements

## Best Practices

* **Use Session IDs**: Leverage `#{UUID}` for maintaining browser state
* **Set Appropriate Timeouts**: Configure timeouts for dynamic content loading
* **Wait for Elements**: Ensure elements are loaded before interaction
* **Handle Dynamic Content**: Account for JavaScript-rendered content
* **Use Descriptive Selectors**: Use clear, stable CSS selectors

## Related Commands

* [Interaction Commands](/stream/commands/interaction) - User interaction commands
* [Parse Commands](/stream/commands/parse) - Parse extracted browser content
* [Validation Commands](/stream/commands/validation) - Validate extracted content
