你好,我是webdriverio的新手,我正在尝试运行命令
DETECT_CHROMEDRIVER_VERSION=true npm i
并且在我得到以下错误之后
npm WARN @hint/hint-amp-validator@2.10.11 requires a peer of hint@^6.0.0 but none is
installed. You must install peer dependencies yourself.
npm WARN allure-mochajs@2.0.0-beta.3 requires a peer of mocha@^5.2.0 but none is
installed. You must install peer dependencies yourself.
npm WARN eslint-config-standard@13.0.1 requires a peer of eslint@>=6.0.1 but none is
installed. You must install peer dependencies yourself.
npm WARN wdio-chromedriver-service@6.0.4 requires a peer of @wdio/cli@^6.0.0 but none
is installed. You must install peer dependencies yourself.
npm WARN wdio-mochawesome-reporter@4.0.0 requires a peer of @wdio/cli@^5.8.4 but none
is installed. You must install peer dependencies yourself.
npm WARN wdio-mochawesome-reporter@4.0.0 requires a peer of mochawesome-report-
generator@^3.1.5 but none is installed. You must install peer dependencies yourself.
npm WARN cnn-content-hub-automation@ No repository field.
npm WARN cnn-content-hub-automation@ No license field.
audited 1875 packages in 12.786s
found 57 vulnerabilities (54 moderate, 3 high)
run `npm audit fix` to fix them, or `npm audit` for details
检测ChromeDriver版本
有时,NPM软件包版本可能并不总是与您的谷歌chrome版本兼容。要获得与安装的Chrome版本相对应的ChromeDriver,可以使用npm配置属性detect_chromedriver_version
。
npm install chromedriver --detect_chromedriver_version
或者将属性添加到.npmrc
文件中。
detect_chromedriver_version=true
另一个选项是使用环境变量DETECT_CHROMEDRIVER_VERSION
。
DETECT_CHROMEDRIVER_VERSION=true npm install chromedriver
注意:当提供属性
detect_chromedriver_version
时,chromedriver_version
和chromedriver_filepath
属性将被忽略。
解决方案
代替:
DETECT_CHROMEDRIVER_VERSION=true npm i
您需要使用:
DETECT_CHROMEDRIVER_VERSION=true npm install chromedriver