SuperAPI AI 工具集

chrome-devtools-cli

通用与其它

查看项目

更新于 10-15 17:34

技能介绍

该工具用于在终端通过命令行(chrome-devtools <tool> [arguments] [flags])与浏览器交互,适合编写 shell 脚本自动化浏览器任务。

主要能力:

  • 页面与导航:new_page、close_page、list_pages、select_page、navigate_page(可 reload/back 并忽略缓存、设置超时)。
  • 交互自动化:take_snapshot 获取元素 uid,再 click、drag、fill、hover、press_key、type_text、upload_file、handle_dialog 等,状态跨命令保持。
  • 调试与检查:evaluate_script 执行 JS,list_console_messages/get_console_message,get_css_styles,take_screenshot(支持整页、JPEG、指定元素)、lighthouse_audit。
  • 网络:list_network_requests、get_network_request,可按资源类型过滤、分页、保存请求或响应到文件。
  • 性能与内存:performance_start_trace/stop_trace、performance_analyze_insight,take_heapsnapshot 以及内存调试命令(需 --memoryDebugging=true)。
  • 其它:emulate、resize_page、扩展管理(list/install/uninstall/reload/trigger_extension_action)、PWA(需 --categoryPwa=true)。

用法要点:首次使用需按 references/installation.md 完成一次性安装。若不知页面 ID,先运行 chrome-devtools list_pages;后台服务隐式启动,无需每次执行 start/status/stop。参数位置为必填、旗标为可选,可用 --help 查看;输出默认为类 Markdown 文本,--output-format=json 可输出 JSON。

限制:默认 CLI 具有完整文件系统访问权限(--allowUnrestrictedPaths=true),可读写系统任意位置,设为 false 时限制在系统临时目录。部分功能需启用对应旗标(如 --memoryDebugging=true、--categoryPwa=true、实验性 --experimentalVision=true、--experimentalScreencast=true(需 ffmpeg)、--categoryExperimentalWebmcp=true、--categoryExperimentalThirdParty=true),实验工具默认关闭。具体收费、平台与效果资料暂未提供。