browser_press_key

Browser Press Key

Press a keyboard key. Supports special keys (Enter, Tab, Escape, arrow keys, etc.) and single characters (a-z, A-Z, 0-9). The key is sent to the currently focused element. Common uses: Enter to submit forms, Tab to move between fields, Escape to close modals, Arrow keys for navigation in menus or sliders, or single characters for keyboard shortcuts.

Usage Example

CURL

POST `/api/execute/browser_press_key`

curl -X POST \
 -H "Authorization: Bearer <token>" \
 -H "Content-Type: application/json" \
 -d '{
"context_id": "ctx_000001",
"key": "<key>"
}' \
http://localhost:8080/api/execute/browser_press_key

Python SDK

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.press_key(
        context_id=context_id,
        key="value"
    )

Node.js SDK

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

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

Parameters

Required

  • context_id string required
    The unique identifier of the browser context (e.g., 'ctx_000001')

  • key string required
    Key to press. Supports special keys: 'Enter', 'Tab', 'Escape', 'Backspace', 'Delete', 'ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight', 'Space', 'Home', 'End', 'PageUp', 'PageDown'. Also supports single characters: 'a'-'z', 'A'-'Z', '0'-'9'. The key is sent to the currently focused element.

Response

Returns a JSON object with the operation result.

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