WebdriverIO中Selenium standalone服务初始化失败问题求助
解决WDIO启动时找不到selenium-standalone服务的问题
问题场景
执行npm run wdio.conf.ts时触发如下错误:
Failed to initilialise launcher service unknown: Error: Couldn't find plugin "selenium-standalone" service, neither as wdio scoped package "@wdio/selenium-standalone-service" nor as community package "wdio-selenium-standalone-service". Please make sure you have it installed!
当前配置信息:
- wdio.conf.ts中的services配置:
services: [['selenium-standalone', { drivers: { firefox: true, chrome: true, chromiumedge: true } }]], - package.json已声明依赖:
"@wdio/cli": "^8.15.6", "@wdio/selenium-standalone-service": "^8.15.0"
排查与解决步骤
- 重新安装依赖:删除
node_modules文件夹和package-lock.json(或yarn.lock)文件,执行npm install确保依赖完整安装 - 确认配置文件导出格式:检查wdio.conf.ts是否正确导出配置对象,示例格式如下:
export const config = { // 其他配置项 services: [['selenium-standalone', { drivers: { firefox: true, chrome: true, chromiumedge: true } }]], // 其他配置项 } - 验证版本兼容性:确保使用的Node.js版本符合WDIO 8.x的要求(推荐16.x或18.x),避免版本不匹配导致的模块加载异常
- 清理WDIO缓存:执行
npx wdio clean清除缓存后,重新运行启动命令
内容的提问来源于stack exchange,提问作者Vijendhar
相关产品推荐
相关产品推荐

