audit-a-page
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseAudit a page with Real A11y
使用Real A11y审计页面
Same engine, two surfaces. Prefer MCP when an agent session already has the
server connected; prefer CLI for shell/CI one-shots.
同一引擎,两种使用方式。如果Agent会话已连接服务器,优先使用MCP;如果是Shell/CI一次性任务,优先使用CLI。
MCP path
MCP 使用流程
- Ensure MCP is wired (). Browser installed via
wire-up-mcp.npx real-a11y install - with the URL. For SPAs use
open_pageand/orwaitUntil: "networkidle". PasssettleMswhen auditing mobile layouts.device - Prefer for a single coherent read on dynamic pages; otherwise
inspect_pageplus views as needed:audit_pageget_semantic_treeget_heading_outlineget_tab_orderlist_elements
- Explain findings in plain language and propose concrete fixes.
- Optional findings loop: → change →
checkpoint_findings.diff_findings - when finished.
close_browser
Respect tool output caps (~40k chars). Do not invent CSS selectors for later
acts — use role + accessible name (see ).
a11y-act-loop- 确保已配置MCP()。通过
wire-up-mcp安装浏览器。npx real-a11y install - 使用打开目标URL。对于SPA(单页应用),需设置
open_page和/或waitUntil: "networkidle"。审计移动端布局时需传入settleMs参数。device - 若需对动态页面进行一次性连贯检测,优先使用;否则可使用
inspect_page并按需调用以下视图:audit_page- (获取语义树)
get_semantic_tree - (获取标题大纲)
get_heading_outline - (获取Tab键导航顺序)
get_tab_order - (列出元素)
list_elements
- 用通俗易懂的语言解释检测结果,并提出具体修复方案。
- 可选的结果循环流程:(记录检测结果)→ 修改页面 →
checkpoint_findings(对比结果差异)。diff_findings - 完成后调用关闭浏览器。
close_browser
注意工具输出限制(约40000字符)。请勿为后续操作自行编写CSS选择器——请使用角色+无障碍名称(详见)。
a11y-act-loopCLI path
CLI 使用流程
sh
npm i -D @real-a11y-dev/cli@beta playwright
npx real-a11y install
npx real-a11y audit https://example.comUseful companions:
sh
npx real-a11y tree https://example.com
npx real-a11y outline https://example.com
npx real-a11y tabs https://example.com
npx real-a11y inspect https://example.com- exits 1 on error-severity findings (CI gate).
audit - Unreachable URL must exit 2 (or equivalent failure) — never a clean “no issues” report.
- There is no flag. Only
--producertakestabs.--root - Optional project config: (
a11y.config.json,defaults).urls
Auth: use + storage-state flags/env — never type
passwords into agent tool calls. Guide:
https://real-a11y.dev/guide/authenticated-pages
real-a11y login … --savesh
npm i -D @real-a11y-dev/cli@beta playwright
npx real-a11y install
npx real-a11y audit https://example.com常用辅助命令:
sh
npx real-a11y tree https://example.com
npx real-a11y outline https://example.com
npx real-a11y tabs https://example.com
npx real-a11y inspect https://example.com- 在检测到严重级别问题时会以1状态码退出(用于CI门禁)。
audit - 若URL无法访问,必须以2(或等效错误状态)退出——绝不能返回“无问题”的干净报告。
- 不存在参数。仅
--producer命令支持tabs参数。--root - 可选项目配置文件:(包含
a11y.config.json、defaults配置项)。urls
身份验证:使用 + storage-state参数/环境变量——切勿在Agent工具调用中输入密码。指南:
https://real-a11y.dev/guide/authenticated-pages
real-a11y login … --saveScope reminder
范围说明
Not a full WCAG/axe suite. Say so when the user expects exhaustive rule
coverage; pair with axe when needed.
本工具并非完整的WCAG/axe测试套件。当用户期望全面的规则覆盖时,请明确告知;必要时可搭配axe工具使用。
Next
下一步
- Interact after open →
a11y-act-loop - CI / PR diffs →
gate-ci-a11y
- 打开页面后进行交互 →
a11y-act-loop - CI / PR差异检测 →
gate-ci-a11y