Browser Automation (Playwright)¶
Use browser tools when web_fetch isn't enough (JS-rendered pages, multi-step flows, forms, screenshots).
Prerequisites¶
Install Playwright (Python):
If your Python executable isn't python3, set REXOS_BROWSER_PYTHON (example: python).
Tool set¶
browser_navigate— open a URL (SSRF-protected by default)browser_click— click by CSS selector (best-effort text fallback)browser_type— fill an inputbrowser_read_page— return{title,url,content}(content is truncated)browser_screenshot— write a PNG to a workspace-relative pathbrowser_close— close the session (idempotent)
Recommended loop¶
browser_navigateto the entry pagebrowser_read_pageto confirm state- One small action:
browser_clickorbrowser_type browser_read_pageagain to confirm the page changed- Repeat until done, then
browser_screenshotfor evidence andbrowser_close
Selector tips¶
Prefer stable attributes over text that may change:
#id[name="q"][data-testid="submit"]button[type="submit"]
If a CSS selector fails, browser_click will try a best-effort visible-text fallback. Be specific (avoid short ambiguous words like “OK”).
Prompt template (copy/paste)¶
Use this as a starting point for agent prompts:
Example run:
Security notes¶
browser_navigatedenies loopback/private targets by default. Useallow_private=trueonly for local/private testing.browser_screenshotonly writes to workspace-relative paths (no absolute paths, no.., no symlink escapes).
Troubleshooting¶
- Error mentions Playwright missing: run the install commands in “Prerequisites”.
- Error mentions
python3missing: setREXOS_BROWSER_PYTHON=python. - Error mentions session not started: call
browser_navigatefirst.