免费在 GitHub 公开
browser-harness
Always use browser-harness for any web interaction: automation, scraping, testing, or site/app work.
中文简介正在准备中。当前显示原文说明。
查看安装方法包含的文件(1)
- SKILL.md1.5 KB
SKILL.md(原文)
安装前可以查看交给 AI 代理的指令内容。
browser-harness
Direct browser control via CDP.
Usage
- Helpers are pre-imported.
run.pycallsensure_daemon()beforeexec. - First navigation is
new_tab(url), notgoto_url(url).
Page Workflow
- Prefer to find elements with the accessibility tree, not screenshots:
cdp("Accessibility.getFullAXTree")["nodes"]has every element's role, name, andbackendDOMNodeId— filter in Python before printing (it is thousands of nodes). Coordinates:q = cdp("DOM.getBoxModel", backendNodeId=n)["model"]["content"]; x, y = sum(q[0::2])/4, sum(q[1::2])/4(viewport px, ready forclick_at_xy; negative/oversized means scroll first). - Clicking: AX node -> box center ->
click_at_xy(x, y)-> verify with a targetedjs(...)/page_info()check. - Fall back to raw HTML via
js(...)only when the AX tree lacks the element (canvas, exotic widgets); screenshot when layout or imagery matters. - After navigation, call
wait_for_load(). - If the current tab is stale or internal, call
ensure_real_tab(). - Use
js(...)for DOM inspection or extraction when coordinates are the wrong tool. - Login walls: stop and ask. Exception: use available SSO automatically when Chrome is already signed in; still stop for passwords, MFA, consent, or ambiguous account choice.
- Raw CDP is available with
cdp("Domain.method", ...).
评价
还没有评价。欢迎分享你的使用感受。
评论
无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。
还没有评论。来写第一条吧。