33

目前我有 Protractor v.5.1.1,Node.js v.6.10.0

所有量角器测试都在窗口控制台中工作,但是当我尝试从 STS IDE 运行它们时,出现以下错误。当然我做了'webdriver-manager update',但它根本没有帮助。有谁知道如何解决这个问题?

当我使用或不使用'directConnect'时分别低于错误

[22:21:48] I/launcher - Running 1 instances of WebDriver
[22:21:48] I/direct - Using ChromeDriver directly...
[22:21:48] E/direct - Error code: 135
[22:21:48] E/direct - Error message: Could not find update-config.json. Run    'webdriver-manager update' to download binaries.
[22:21:48] E/direct - Error: Could not find update-config.json. Run 'webdriver-manager update' to download binaries.
at IError  (D:\STS_workspace\jgh\node_modules\protractor\built\exitCodes.js:5:1)
at ProtractorError (D:\STS_workspace\jgh\node_modules\protractor\built\exitCodes.js:10:9)
at BrowserError (D:\STS_workspace\jgh\node_modules\protractor\built\exitCodes.js:51:9)
at Direct.getNewDriver (D:\STS_workspace\jgh\node_modules\protractor\built\driverProviders\direct.js:62:31)
at Runner.createBrowser (D:\STS_workspace\jgh\node_modules\protractor\built\runner.js:194:43)
at q.then.then (D:\STS_workspace\jgh\node_modules\protractor\built\runner.js:338:29)
at _fulfilled (D:\STS_workspace\jgh\node_modules\q\q.js:834:54)
at self.promiseDispatch.done (D:\STS_workspace\jgh\node_modules\q\q.js:863:30)
at Promise.promise.promiseDispatch (D:\STS_workspace\jgh\node_modules\q\q.js:796:13)
at D:\STS_workspace\jgh\node_modules\q\q.js:556:49
[22:21:48] E/launcher - Process exited with error code 135

或者

[21:19:23] I/launcher - Running 1 instances of WebDriver
[21:19:23] E/local - Error code: 135
[21:19:23] E/local - Error message: No update-config.json found. Run    'webdriver-manager update' to download binaries.
[21:19:23] E/local - Error: No update-config.json found. Run 'webdriver- manager update' to download binaries.
   at IError (D:\STS_workspace\jgh\node_modules\protractor\built\exitCodes.js:5:1)
   at ProtractorError (D:\STS_workspace\jgh\node_modules\protractor\built\exitCodes.js:10:9)
   at BrowserError (D:\STS_workspace\jgh\node_modules\protractor\built\exitCodes.js:51:9)
   at Local.addDefaultBinaryLocs_ (D:\STS_workspace\jgh\node_modules\protractor\built\driverProviders\local.js:40:23)
   at Local.setupDriverEnv (D:\STS_workspace\jgh\node_modules\protractor\built\driverProviders\local.js:81:14)
   at Local.setupEnv  (D:\STS_workspace\jgh\node_modules\protractor\built\driverProviders\driverProvider.js:110:34)
   at q.then (D:\STS_workspace\jgh\node_modules\protractor\built\runner.js:334:41)
   at _fulfilled (D:\STS_workspace\jgh\node_modules\q\q.js:834:54)
   at self.promiseDispatch.done    (D:\STS_workspace\jgh\node_modules\q\q.js:863:30)
   at Promise.promise.promiseDispatch     (D:\STS_workspace\jgh\node_modules\q\q.js:796:13)
[21:19:23] E/launcher - Process exited with error code 135

我的 conf.js 看起来像:

var SpecReporter = require('jasmine-spec-reporter').SpecReporter;

exports.config = {
  //    directConnect:true,
  specs: ['spec4.js'],
 framework: 'jasmine2' ,

 onPrepare: function () {
  jasmine.getEnv().addReporter(new SpecReporter({
  spec: {
    displayStacktrace: true,
    displaySuccessesSummary: true,
    displayFailuresSummary: true,  
    displayPendingSummary: true,
    displaySpecDuration: true,     
      },

    }));
  },

  jasmineNodeOpts: {
    defaultTimeoutInterval: 25000,
    print: function () {},
},

我在 node_modules/protractor/node_modules/webdriver-manager 路径中没有 selenium 文件夹,但我在 package.json 中添加了“webdriver-update”:“webdriver-manager update”。这是 npm run webdriver-update 的输出:

    D:\STS_workspace\jgh>npm run webdriver-update
    npm WARN invalid config proxy="http:"  
    npm WARN invalid config Must be a full url with 'http://'
    npm WARN invalid config proxy="http:"
    npm WARN invalid config Must be a full url with 'http://'
    npm ERR! Windows_NT 10.0.14393
    npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program     Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "webdriver-update"
    npm ERR! node v6.10.0
    npm ERR! npm  v3.10.10
    npm ERR! path D:\STS_workspace\jgh\package.json
    npm ERR! code ENOENT
    npm ERR! errno -4058
    npm ERR! syscall open
    npm ERR! enoent ENOENT: no such file or directory, open 'D:\STS_workspace\jgh\package.json'
    npm ERR! enoent ENOENT: no such file or directory, open 'D:\STS_workspace\jgh\package.json'
    npm ERR! enoent This is most likely not a problem with npm itself
    npm ERR! enoent and is related to npm not being able to find a file.
    npm ERR! enoent

npm ERR! Please include the following file with any support request:
npm ERR!     D:\STS_workspace\jgh\npm-debug.log
4

9 回答 9

54

看起来您正在使用directConnect或启动配置文件中的local驱动程序提供程序(没有seleniumAddressor directConnect)。你需要运行webdriver-manager update.

以前我有额外的标志不能下载独立或壁虎webdriver-manager update --standalone false --gecko false。如果您从本地驱动程序提供商开始,则不再是这种情况。您将需要 selenium 独立 jar 文件。

您可以使用 package.json 中的脚本运行它。就像是:

"scripts": {
  "webdriver-update": "webdriver-manager update"
}

然后执行这个:npm run webdriver-update。你如何检查二进制文件是否存在?在您的项目中,导航到node_modules/protractor/node_modules/webdriver-manager/selenium/. 这是update-config.json您下载的二进制文件所在的位置。

于 2017-02-25T07:04:46.347 回答
52

您可以尝试像这样更新它,它肯定会在 node_modules/protractor 中更新它:

$ ./node_modules/protractor/bin/webdriver-manager update
于 2018-02-20T15:30:50.780 回答
23

只需在项目文件夹中使用npx命令执行webdriver-manager ;

npx webdriver-manager update
于 2018-07-04T17:54:11.057 回答
2

在 MacOS 上,我通过将 seleniumAddress 添加到我的 Protractor 配置文件中解决了这个错误(我之前使用的是 directConnect,所以注释掉了):

// directConnect: true,
// baseUrl: 'http://localhost:4000/',
seleniumAddress: 'http://localhost:4444/wd/hub/',

我现在通过运行以下命令启动 Protractor 服务器:$ webdriver-manager start

在另一个终端窗口中,我开始测试:$ ng e2e

于 2018-02-07T19:14:15.850 回答
1

您只需要运行此命令并对其进行修复 -npm run webdriver-update它会在 node_modules 部分下更新您的 webdriver node_modules/protractor

这两条线是罪魁祸首。只需尝试运行该命令,它应该可以解决您的问题。

[22:21:48] E/direct - Error message: Could not find update-config.json. Run 'webdriver-manager update' to download binaries.
[22:21:48] E/direct - Error: Could not find update-config.json. Run 'webdriver-manager update' to download binaries.

希望有帮助!

于 2017-11-15T17:29:11.910 回答
1

我直接在里面运行 npx webdriver-manager update 命令

$\node_modules\protractor\bin 并且它开始按预期工作。

遍历您的 e2e 中的上述文件夹并运行命令。

于 2021-11-09T09:24:33.347 回答
0

当我在 Windows 10 中安装 Java 并更新 Java Path 时,问题就解决了。

于 2020-03-30T03:38:27.727 回答
0

就我而言

npm run webdriver-manager update

只更新app\node_modules\webdriver-manager不更新app\node_modules\protractor\node_modules\webdriver-manager\。无论我是直接从控制台还是作为 package.json 脚本运行该命令。我不得不跑

npx webdriver-manager update

里面app\node_modules\protractor\node_modules\webdriver-manager\

另一个解决方案是这个脚本:

"postinstall": "node ./node_modules/protractor/node_modules/webdriver-manager update"
于 2020-06-25T13:32:24.150 回答
0

有了这个,我可以继续进行节点 node_modules/protractor/bin/webdriver-manager 更新

于 2020-07-27T06:47:31.493 回答