首页 > 解决方案 > 无法解决依赖关系 - webdriverIO

问题描述

我正在尝试使用(npm run test-local)运行我的 WebdriverIo Specs,即使您的 package.json 中有所有依赖项,我也会收到以下错误,如下所述

[0-2] 错误:创建会话失败。转发新会话时出错 VM 的空池以进行设置 Capabilities {browserName: chrome, goog:chromeOptions: {}}*

npm WARN grunt-webdriver@3.0.0 需要 @wdio/cli@^5.1.0 的对等点,但没有安装。您必须自己安装对等依赖项。npm WARN grunt-webdriver@3.0.0 需要 webdriverio@^5.1.0 的对等点,但没有安装。您必须自己安装对等依赖项。npm WARN wdio-chromedriver-service@6.0.4 需要 chromedriver@ 的对等方,但没有安装。您必须自己安装对等依赖项*


"scripts": {
    "allure:history": "mkdir -p allure-report/history ./test/reports/allure-results/history && cp -a allure-report/history ./test/reports/allure-results/",
    "allure-report": "node_modules/.bin/allure generate --clean ./test/reports/allure-results && allure open",
    "junit-report": "node_modules/.bin/junit-viewer --results=./test/reports/junit-results --save=junit-results.html && open junit-results.html",
    "test-sauce": "wdio ./test/config/wdio.sauce.conf.js",
    "test-browserstack": "wdio ./test/config/wdio.browserstack.conf.js",
    "test-local": "npm run allure:history && wdio ./test/config/wdio.local.conf.js",
    "test-mobile": "wdio ./test/config/wdio.appium.conf.js"
  },
"dependencies": {},
  "devDependencies": {
    "@babel/cli": "^7.8.4",
    "@babel/core": "^7.9.0",
    "@babel/plugin-syntax-export-default-from": "^7.8.3",
    "@babel/preset-env": "^7.9.0",
    "@babel/register": "^7.9.0",
    "@wdio/allure-reporter": "^6.4.7",
    "@wdio/appium-service": "^6.4.7",
    "@wdio/browserstack-service": "^6.4.7",
    "@wdio/cli": "^6.0.5",
    "@wdio/junit-reporter": "^6.4.7",
    "@wdio/local-runner": "^6.0.5",
    "@wdio/mocha-framework": "^6.4.7",
    "@wdio/sauce-service": "^6.0.4",
    "@wdio/selenium-standalone-service": "^6.1.4",
    "@wdio/spec-reporter": "^6.0.4",
    "@wdio/sync": "^6.0.1",
    "allure-commandline": "^2.13.0",
    "babel-plugin-source-map-support": "^2.1.3",
    "eslint": "^7.2.0",
    "eslint-config-standard": "^14.1.1",
    "eslint-plugin-import": "^2.20.2",
    "eslint-plugin-node": "^11.1.0",
    "eslint-plugin-promise": "^4.2.1",
    "eslint-plugin-standard": "^4.0.1",
    "grunt": "^1.3.0",
    "grunt-cli": "^1.3.2",
    "grunt-mocha": "^1.2.0",
    "grunt-webdriver": "^3.0.0",
    "junit-viewer": "^4.11.1",
    "node-excel-to-json": "0.0.3",
    "selenium-standalone": "^6.20.0",
    "underscore": "^1.11.0",
    "wdio-chromedriver-service": "^6.0.2",
    "wdio-json-reporter": "^2.0.0"
  }

标签: javascriptnode.jsselenium-webdrivernpmwebdriver-io

解决方案


确保 selenium 独立服务器已启动并正在运行

java -jar selenium-server-standalone-3.141.59.jar -role node -hub http://localhost:4444/grid/register -browser "browserName=chrome,maxinstance=1

上面的命令对我有用!


推荐阅读