WebdriverIO CLI
$ wdio 基金会 中风险WebdriverIO CLI(wdio,来自 @wdio/cli)通过 wdio run wdio.conf.js 编排并行的 WebDriver、Chrome DevTools 与 Appium 移动端端到端测试套件。支持 --spec、--suite、--logLevel,并可通过 @wdio/json-reporter 生成结构化 JSON 报告。
npm install -D @wdio/cli 运行确定性的 WebDriver/Appium CI 测试套件适合使用 wdio run;临时探索性网页交互则适合使用浏览器 MCP 或子 Agent。
Agent 友好度体检单
当前为静态评估(本机尚未安装或尚未运行探针)。可在本地运行 npm run data:probe 并提交 data/probes/ 升级为实测证据。
FCRS-1.0 六维评分拆解
wdio run 支持确定性执行及 --spec、--bail、--logLevel 控制,但 wdio config 默认交互且 JSON 报告需配置 @wdio/json-reporter。
- Supports
wdio run --spec,--logLevel, and@wdio/json-reporter
仅针对配置好的本地或测试环境 URL 运行限定测试套件,且只写本地测试报告文件。
- Scoped via
wdio.conf.jsand--spec/--suite
可通过 @wdio/cli(npm/npx)跨平台安装,但需配套 Node.js 及本地浏览器或 Appium/Selenium 驱动。
- Distributed via
npmandnpxacross macOS, Linux, Windows
以多进程并行能力统一桌面端 WebDriver/BiDi、Electron 与移动端 Appium 自动化测试。
- Supports WebDriver BiDi, Chrome DevTools, and Appium services
OpenJS 基金会项目(webdriverio/webdriverio),MIT 开源且版本更新活跃。
- OpenJS Foundation project under MIT license
官网 webdriver.io 提供覆盖 CLI 参数、Reporter 与 Service 的详尽文档。
- Official CLI reference at
https://webdriver.io/docs/clioptions
安全边界、鉴权与放权指南
可选从环境变量或 wdio.conf.js 读取云测平台密钥(如 SAUCE_USERNAME/BROWSERSTACK_KEY)。
免费且基于 MIT 开源的 OpenJS 基金会项目。
# WebdriverIO (wdio) Agent Rules - Never run `npx wdio config` without `--yes` (it launches an interactive setup questionnaire). - Scope test runs with `--spec <path>` or `--suite <name>` and `--logLevel error`. - Enable `@wdio/json-reporter` in `wdio.conf.js` when structured pass/fail artifacts are needed.
Agent 高频安全命令配方
只读查询(安全推荐)
npx wdio run wdio.conf.js --spec ./test/specs/smoke.e2e.js --logLevel error
指定 --logLevel error 运行单个测试文件,显著减少运行器冗余日志。
npx wdio run --help
不启动浏览器即可查看 --spec、--suite、--bail 与 --logLevel 等支持参数。
核心优势
- + 同一运行器(
wdio run)即可统筹 WebDriver BiDi、桌面浏览器与移动端 Appium 测试。 - +
--spec、--suite、--bail与--logLevel参数精细,适合收敛 CI 运行范围。
注意事项与踩坑点
- ! 默认不在标准输出打印 JSON 报告,需在
wdio.conf.js中接入@wdio/json-reporter。 - ! 未加
--yes直接运行wdio config会进入交互式配置问答。