# browser_type

## Browser Type

Type text into an input field with human-like keystroke simulation. Target the field using CSS selector, coordinates, or natural language (e.g., 'email field'). When selector is omitted, types into the currently focused element. Note: Does NOT clear existing content - use browser_clear_input first if you need to replace text rather than append.

## Usage Example

### Python SDK

```python
import asyncio
from owl_browser import OwlBrowser, RemoteConfig

# Async usage
async with OwlBrowser(config) as browser:
    context = await browser.create_context()
    context_id = context["context_id"]
    await browser.type(
        context_id=context_id,
        text="value"
    )
```

### Node.js SDK

```javascript
import { OwlBrowser } from '@olib-ai/owl-browser-sdk';

// Async usage
const ctx = await browser.createContext();
const contextId = ctx.context_id;
await browser.type({
    context_id: contextId,
    text: 'value'
});
```

## Parameters

### Required

- `context_id` string required
    - The unique identifier of the browser context (e.g., 'ctx_000001')
- `text` string required
    - The text to type into the input field. Simulates real keystrokes with human-like timing. Existing content is NOT cleared - use browser_clear_input first if needed

### Optional

- `selector` string
    - Target input field. Accepts: CSS selector (e.g., '#email', 'input[name="username"]'), XY coordinates (e.g., '100x200'), or natural language description (e.g., 'email field', 'search box'). When omitted, types into the currently focused element (document.activeElement)
- `index` string
    - When multiple elements match the selector, target the Nth element (0-based). Uses querySelectorAll()[index] instead of querySelector(). Default: -1 (first match)

## Response

Returns a JSON object with the operation result.

```json
{
  "success": true,
  "result": <value>
}
```
