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

# Browser Tools

> Automate web interactions with browser control.

Enable browser control with the `--browser` flag:

```bash theme={null}
lukan --browser
```

## Browser Options

| Flag                       | Description                               |
| -------------------------- | ----------------------------------------- |
| `--browser-visible`        | Launch Chrome with visible window         |
| `--browser-user-profile`   | Use default Chrome profile                |
| `--browser-cdp <url>`      | Connect to existing Chrome via CDP        |
| `--browser-allow-internal` | Allow navigation to internal/private URLs |

## Available Tools

| Tool                | Description                                                  |
| ------------------- | ------------------------------------------------------------ |
| `BrowserNavigate`   | Navigate to a URL                                            |
| `BrowserNewTab`     | Open a new tab                                               |
| `BrowserSnapshot`   | Take an accessibility tree snapshot (compact mode available) |
| `BrowserScreenshot` | Take a JPEG screenshot of the current page                   |
| `BrowserClick`      | Click an element by reference number                         |
| `BrowserType`       | Type text into an input field                                |
| `BrowserEvaluate`   | Evaluate JavaScript (with security blocklist)                |
| `BrowserSavePDF`    | Save the current page as a PDF file                          |
| `BrowserTabs`       | List open tabs                                               |
| `BrowserSwitchTab`  | Switch between tabs                                          |

## Usage Examples

```typescript theme={null}
// Navigate to a page
BrowserNavigate({ url: "https://example.com" })

// Take a screenshot
BrowserScreenshot({})

// Click an element (use selector from snapshot)
BrowserClick({ selector: "#submit-button" })

// Type in an input
BrowserType({ selector: "#search-input", text: "search query" })

// Evaluate JavaScript
BrowserEvaluate({ script: "return document.title" })

// Switch tabs
BrowserSwitchTab({ tabIndex: 1 })

// Save page as PDF
BrowserSavePDF({ path: "output.pdf" })
```

## Connecting to Existing Chrome

Instead of launching a new Chrome instance, connect to one already running:

```bash theme={null}
# Start Chrome with remote debugging
google-chrome --remote-debugging-port=9222

# Connect Lukan to it
lukan --browser --browser-cdp http://localhost:9222
```

This is useful when you need to continue a session that was already authenticated.
