使用grunt量角器获得错误

时间:2016-03-03 18:57:04

标签: java node.js selenium gruntjs protractor

我已使用此命令为grunt安装了java:

npm install grunt-run-java --save-dev

然后我将grunt.loadNpmTasks('grunt-run-java');放入我的grunt文件中。在那之后,当我尝试运行grunt量角器时,它会抛出以下错误:

Running "protractor:chrome" (protractor) task
WARNING - You have specified both capabilites and multiCapabilities. This will result in capabilities being ignored
Starting selenium standalone server...
[launcher] Running 1 instances of WebDriver
[launcher] Process exited with error code 1
events.js:141
      throw er; // Unhandled 'error' event
      ^

Error: spawn java ENOENT
    at exports._errnoException (util.js:856:11)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:178:32)
    at onErrorNT (internal/child_process.js:344:16)
    at doNTCallback2 (node.js:452:9)
    at process._tickCallback (node.js:366:17)
>> events.js:141
>>       throw er; // Unhandled 'error' event
>>       ^
>>
>> Error: spawn java ENOENT
>>     at exports._errnoException (util.js:856:11)
>>     at Process.ChildProcess._handle.onexit (internal/child_process.js:178:32)
>>     at onErrorNT (internal/child_process.js:344:16)
>>     at doNTCallback2 (node.js:452:9)
>>     at process._tickCallback (node.js:366:17)
>> Test failed but keep the grunt process alive.

如何防止此错误?

1 个答案:

答案 0 :(得分:0)

您似乎同时包含capabilitiesmultiCapabilities。你应该有一个或另一个。由于它们被忽略,因此selenium服务器不知道您的测试将运行哪个浏览器。