WebdriverIO Chromedriver服务安装后失败

时间:2018-07-15 14:41:27

标签: webdriver-io

我是webdriverIO的初学者。我已经在Web驱动程序IO文档的帮助下开始使用TestRunner。 我安装了节点,并期望对此命令做出响应

./node_modules/.bin/wdio --help

我使用

定义了配置
 ./node_modules/.bin/wdio config

但是当我跑步

./node_modules/.bin/wdio wdio.conf.js

它给我以下错误

Error: Couldn't initialise launcher from service "chromedriver".
Error: Cannot find module 'chromedriver'
    at Function.Module._resolveFilename (module.js:555:15)
    at Function.Module._load (module.js:482:25)
    at Module.require (module.js:604:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/Users/userName/node_modules/wdio-chromedriver-service/build/launcher.js:9:21)
    at Module._compile (module.js:660:30)
    at Object.Module._extensions..js (module.js:671:10)
    at Module.load (module.js:573:32)
    at tryModuleLoad (module.js:513:12)
    at Function.Module._load (module.js:505:3)
    at Launcher.getLauncher (/Users/userName/node_modules/webdriverio/build/lib/launcher.js:815:35)
    at Launcher._callee$ (/Users/userName/node_modules/webdriverio/build/lib/launcher.js:234:49)
    at tryCatch (/Users/userName/node_modules/regenerator-runtime/runtime.js:62:40)
    at Generator.invoke [as _invoke] (/Users/userName/node_modules/regenerator-runtime/runtime.js:296:22)
    at Generator.prototype.(anonymous function) [as next] (/Users/userName/node_modules/regenerator-runtime/runtime.js:114:21)
    at step (/Users/userName/node_modules/webdriverio/node_modules/babel-runtime/helpers/asyncToGenerator.js:17:30)
    at /Users/userName/node_modules/webdriverio/node_modules/babel-runtime/helpers/asyncToGenerator.js:35:14
    at new Promise (<anonymous>)
    at new F (/Users/userName/node_modules/webdriverio/node_modules/core-js/library/modules/_export.js:36:28)
    at Launcher.<anonymous> (/Users/userName/node_modules/webdriverio/node_modules/babel-runtime/helpers/asyncToGenerator.js:14:12)

1 个答案:

答案 0 :(得分:5)

我以前遇到过这个问题。归结为wdio-chromedriver-service没有安装chromedriver作为依赖项。

要解决此问题,只需运行: npm i chromedriver --save-dev