@ accesslint/ 颜色
确保 可调试的染色体 accessLint的现场DOM审核可以驱动 管理它的生命周期.
AccessLint CLI (英语:@accesslint/cli)是纯 CDP 客户端: 给它调试
端点和一个 URL, 它会注入 @accesslint/core 审计。 没有
发射克洛姆 这个软件包填补了这一空白,并发射了Chrome 分离 这样
它的寿命超过启动它的一发发射装置过程.
为什么一个单独的包
chrome-launcher是因为 launch() 将克洛姆的一生与召唤过程联系起来,
这对一个错误 npx- 式一发:当命令退出时,Chrome会
在审计连接之前死亡。 因此,这个包 产出克罗梅脱落,记录
它的 pid + 丢弃 profile 到状态文件, 并暴露明确 stop。 。 。 .
它也编码 HTTP 发现陷阱: 通过 DevTools 打开的克罗姆
复选框(或 chrome-devtools-mcp)将调试端口打开,但只服务于 a
韦伯索克- chrome-remote-interface 不能开它。 此软件包处理一个
只有在 /json/version 回答,从来没有在赤裸的TCP探测器.
当针入端口时( W)--port 或者说 ACCESSLINT_CDP_PORT如果端口是
蹲下,所以呼叫者要对着他们要求的港口,一个没有钉住的
ensure 步骤改为下一个自由端口.
使用量
# Get-or-launch a driveable Chrome; prints its endpoint as JSON.
npx @accesslint/chrome ensure
# → {"ok":true,"mode":"launched","host":"127.0.0.1","port":9222,"pid":1234,"managed":true,...}
# Idempotent: a second ensure attaches to the running one.
npx @accesslint/chrome ensure # → {"mode":"attached",...}
# Tear it down.
npx @accesslint/chrome stop --all
图标
| 命令 | 它会做什么 |
|---|---|
ensure | 端口的可驱动克洛姆,或发射可分离克洛姆. |
stop | 杀死管理实例( E)--port) 或所有(--all)并取净. |
选项
-p, --port <n> CDP port to attach to / launch on (default 9222)
--headed Launch a visible Chrome instead of headless (ensure)
--download Download a managed Chrome for Testing if none is installed (ensure)
--all Stop every managed instance (stop)
如果默认端口被一个 不可驱动 Chrome( 复选框模式) ,
一个没有标记的 ensure 步骤至自由端口并报告实际端口——读取
port 从它的 JSON 输出。 如果你把那个端口钉住 --port, (中文(简体) ), ensure
失败; 释放端口或通过另一个端口 .
默认 ensure 使用系统Chrome(CHROME_PATH 或平台搜索)
如果找不到, 则失败 。 过 --download (或设置) ACCESSLINT_CHROME_DOWNLOAD=1(中文(简体) )
回到被钉住的地上 测试颜色 通过
@puppeteer/browsers 输入缓存目录。 下载(~170MB)一次
首先使用; 后运行再使用缓存二进制 。 一个系统Chrome,当存在时,
总是取胜——下载只是回放.
环境
ACCESSLINT_CDP_PORT default port
CHROME_PATH override Chrome binary discovery
ACCESSLINT_CHROME_DOWNLOAD 1/true to enable the Chrome for Testing fallback
ACCESSLINT_CHROME_CACHE_DIR where downloaded Chrome is cached (default ~/.cache/accesslint-chrome)
图书馆 API
import { ensure, stop } from "@accesslint/chrome";
const chrome = await ensure({ port: 9222 }); // { mode, host, port, pid, managed, ... }
// … run an audit against chrome.host:chrome.port …
await stop({ port: chrome.port });
许可证
麻省理工学院