Clicking and Typing
import { Aside } from ‘@astrojs/starlight/components’;
ptah_browser_click
Section titled “ptah_browser_click”Click an element selected by CSS selector, text, or absolute coordinates.
Arguments
Section titled “Arguments”| Name | Type | Required | Description |
|---|---|---|---|
selector | string | conditional | CSS or text selector (e.g. button.submit, text=Sign in) |
x | number | conditional | Viewport-relative x coordinate |
y | number | conditional | Viewport-relative y coordinate |
button | enum | no | left (default), right, or middle |
clickCount | number | no | Defaults to 1; use 2 for double-click |
timeoutMs | number | no | How long to wait for the element to become actionable |
Either a selector or a (x, y) pair is required.
Example
Section titled “Example”{ "tool": "ptah_browser_click", "arguments": { "selector": "text=Accept all cookies" }}Ptah will scroll the element into view, wait for it to become stable and enabled, and then click. If the element is covered by another element or detached during the wait, the call retries until the timeout expires.
ptah_browser_type
Section titled “ptah_browser_type”Type text into a focused input or a specific selector.
Arguments
Section titled “Arguments”| Name | Type | Required | Description |
|---|---|---|---|
selector | string | no | If provided, focuses the element before typing |
text | string | yes | Text to type |
delayMs | number | no | Per-keystroke delay; defaults to 0 for instant input |
clearFirst | boolean | no | If true, selects all existing text and replaces it |
Example
Section titled “Example”{ "tool": "ptah_browser_type", "arguments": { "selector": "input[name=email]", "clearFirst": true }}Special keys
Section titled “Special keys”Use JavaScript escape sequences for control characters. For more complex key sequences (e.g. Tab, Enter, Shift+A) use ptah_browser_evaluate with Playwright’s keyboard API:
await page.keyboard.press('Enter');