gulp-angular-protractor崩溃,错误代码为135

时间:2017-05-10 13:18:54

标签: angularjs gulp webdriver protractor

我正在尝试在Angular 1.x系统上运行一些e2e测试,但每当我尝试运行gulp-angular-protractor测试时,我都会收到此错误:

[TIME] E/launcher - Process exited with error code 135
[TIME] gulp-angular-protractor - An error occured to stop the Webdriver standalone server

以下是我安装的软件包:

本地

├── angular@1.6.4
├── angular-animate@1.6.4
├── angular-aria@1.6.4
├── angular-cookies@1.6.4
├── angular-local-storage@0.5.2
├── angular-material@1.1.4
├── angular-messages@1.6.4
├── angular-mocks@1.6.4
├── angular-paging@2.2.2
├── angular-poller@0.4.5
├── angular-sanitize@1.6.4
├── angular-svg-round-progressbar@0.4.8
├── angular-translate@2.15.1
├── angular-translate-loader-partial@2.15.1
├── angular-ui-router@1.0.3
├── angular-wizard@0.10.0
├── angulartics@1.4.0
├── angulartics-google-analytics@0.4.0
├── babel-core@6.24.1
├── babel-eslint@7.2.3
├── babel-loader@6.4.1
├── babel-plugin-transform-runtime@6.23.0
├── babel-polyfill@6.23.0
├── babel-preset-es2015@6.24.1
├── babel-preset-stage-0@6.24.1
├── babel-register@6.24.1
├── babel-runtime@6.23.0
├── browser-sync@2.18.8
├── browserify-sign@4.0.0
├── buffer-loader@0.0.1
├── chai@3.5.0
├── checklist-model@0.10.0
├── connect-history-api-fallback@1.3.0
├── constants@0.0.2
├── copy-webpack-plugin@4.0.1
├── crypto-browserify@3.11.0
├── crypto-js@3.1.9-1
├── css-loader@0.26.4
├── del@2.2.2
├── eslint@3.19.0
├── eslint-plugin-angular@1.6.4
├── file-loader@0.10.1
├── fingerprintjs2@1.5.1
├── fs-walk@0.0.1
├── git-rev-sync@1.9.1
├── gulp@3.9.1
├── gulp-angular-protractor@1.0.0
├── gulp-ng-constant@2.0.0-2
├── gulp-rename@1.2.2
├── gulp-replace@0.5.4
├── gulp-template@4.0.0
├── gulp-util@3.0.8
├── html-webpack-plugin@2.28.0
├── image-webpack-loader@3.3.1
├── json-override@0.2.0
├── karma@1.7.0
├── karma-chai@0.1.0
├── karma-chrome-launcher@2.1.1
├── karma-mocha@1.3.0
├── karma-mocha-reporter@2.2.3
├── karma-sourcemap-loader@0.3.7
├── karma-webpack@1.8.1
├── lodash@4.17.4
├── mocha@3.3.0
├── ng-annotate-loader@0.2.0
├── ngmap@1.17.8
├── node-libs-browser@2.0.0
├── node-rsa@0.4.2
├── protractor@5.1.1
├── raw-loader@0.5.1
├── style-loader@0.13.2
├── stylus@0.54.5
├── stylus-loader@2.5.1
├── supports-color@3.2.3
├── ua-parser-js@0.7.12
├── v-accordion@1.6.0
├── webdriver-manager@12.0.6
├── webpack@1.15.0
├── webpack-dev-middleware@1.10.2
├── webpack-hot-middleware@2.18.0
└── yargs@6.6.0

全局

├── gulp@3.9.1
├── karma@1.7.0
├── karma-cli@1.0.1
├── n@2.1.7
├── npm@3.10.10
└── webpack@2.5.1

这是我运行量角器gulp任务时得到的完整错误日志:

NickF$ gulp protractor
[14:04:26] Requiring external module babel-register
[14:04:27] Using gulpfile ~/WebstormProjects/phoenix-web/gulpfile.babel.js
[14:04:27] Starting 'protractor'...
[14:04:27] gulp-angular-protractor - The plugin is retrieved and will start soon
[14:04:27] gulp-angular-protractor - We will try to start and stop automatically the WebDriver server
[14:04:28] gulp-angular-protractor - The selenium address is: http://localhost:4444/wd/hub
[14:04:28] gulp-angular-protractor - The selenium address used is: http://localhost:4444/wd/hub
[14:04:28] gulp-angular-protractor - The selenium shutdown address used is: http://localhost:4444/selenium-server/driver/?cmd=shutDownSeleniumServer
[14:04:28] gulp-angular-protractor - We have the config file to the following path: /Users/NickF/WebstormProjects/phoenix-web/protractor.config.js
[14:04:28] gulp-angular-protractor - Webdriver standalone will be updated
[14:04:28] I/file_manager - creating folder /Users/NickF/WebstormProjects/phoenix-web/node_modules/webdriver-manager/selenium
[14:04:45] I/update - chromedriver: unzipping chromedriver_2.29.zip
[14:04:45] I/update - chromedriver: setting permissions to 0755 for /Users/NickF/WebstormProjects/phoenix-web/node_modules/webdriver-manager/selenium/chromedriver_2.29
[14:04:53] I/update - geckodriver: unzipping geckodriver-v0.16.1.tar.gz
[14:04:53] I/update - geckodriver: setting permissions to 0755 for /Users/NickF/WebstormProjects/phoenix-web/node_modules/webdriver-manager/selenium/geckodriver-v0.16.1
[14:04:55] gulp-angular-protractor - Webdriver standalone is updated
[14:04:55] gulp-angular-protractor - Webdriver standalone server will be started
[14:04:56] [14:04:56] I/start - java -Dwebdriver.chrome.driver=/Users/NickF/WebstormProjects/phoenix-web/node_modules/webdriver-manager/selenium/chromedriver_2.29 -Dwebdriver.gecko.driver=/Users/NickF/WebstormProjects/phoenix-web/node_modules/webdriver-manager/selenium/geckodriver-v0.16.1 -jar /Users/NickF/WebstormProjects/phoenix-web/node_modules/webdriver-manager/selenium/selenium-server-standalone-3.4.0.jar -port 4444

[14:04:56] [14:04:56] I/start - seleniumProcess.pid: 6487

[14:04:56] 14:04:56.915 INFO - Selenium build info: version: '3.4.0', revision: 'unknown'

[14:04:56] 14:04:56.916 INFO - Launching a standalone Selenium Server

[14:04:56] 2017-05-10 14:04:56.955:INFO::main: Logging initialized @362ms to org.seleniumhq.jetty9.util.log.StdErrLog
[14:04:56] 

[14:04:57] 14:04:57.054 INFO - Driver provider org.openqa.selenium.ie.InternetExplorerDriver registration is skipped:
 registration capabilities Capabilities [{ensureCleanSession=true, browserName=internet explorer, version=, platform=WINDOWS}] does not match the current platform MAC

[14:04:57] 14:04:57.055 INFO - Driver provider org.openqa.selenium.edge.EdgeDriver registration is skipped:
 registration capabilities Capabilities [{browserName=MicrosoftEdge, version=, platform=WINDOWS}] does not match the current platform MAC

[14:04:57] 14:04:57.056 INFO - Driver class not found: com.opera.core.systems.OperaDriver

[14:04:57] 14:04:57.056 INFO - Driver provider com.opera.core.systems.OperaDriver registration is skipped:
Unable to create new instances on this machine.

[14:04:57] 14:04:57.057 INFO - Driver class not found: com.opera.core.systems.OperaDriver

[14:04:57] 14:04:57.057 INFO - Driver provider com.opera.core.systems.OperaDriver is not registered

[14:04:57] 2017-05-10 14:04:57.144:INFO:osjs.Server:main: jetty-9.4.3.v20170317
[14:04:57] 

[14:04:57] 2017-05-10 14:04:57.214:INFO:osjsh.ContextHandler:main: Started o.s.j.s.ServletContextHandler@d8355a8{/,null,AVAILABLE}
[14:04:57] 

[14:04:57] 2017-05-10 14:04:57.285:INFO:osjs.AbstractConnector:main: Started ServerConnector@146ba0ac{HTTP/1.1,[http/1.1]}{0.0.0.0:4444}
[14:04:57] 

[14:04:57] 2017-05-10 14:04:57.289:INFO:osjs.Server:main: Started @696ms

[14:04:57] 14:04:57.289 INFO - Selenium Server is up and running

[14:04:57] gulp-angular-protractor - Webdriver standalone server is started
[14:04:57] gulp-angular-protractor - We will run the Protractor engine
[14:04:58] D/launcher - Running with --troubleshoot
[14:04:58] D/launcher - Protractor version: 5.1.1
[14:04:58] D/launcher - Your base url for tests is http://localhost:80
[14:04:58] I/launcher - Running 1 instances of WebDriver
[14:04:58] I/hosted - Using the selenium server at http://localhost:4444/wd/hub
[14:04:58] E/launcher - Error code: 135
[14:04:58] E/launcher - Error message: ECONNREFUSED connect ECONNREFUSED ::1:4444
[14:04:58] E/launcher - Error: ECONNREFUSED connect ECONNREFUSED ::1:4444
    at ClientRequest.<anonymous> (/Users/NickF/WebstormProjects/phoenix-web/node_modules/selenium-webdriver/http/index.js:238:15)
    at emitOne (events.js:96:13)
    at ClientRequest.emit (events.js:188:7)
    at Socket.socketErrorListener (_http_client.js:309:9)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:188:7)
    at emitErrorNT (net.js:1277:8)
    at _combinedTickCallback (internal/process/next_tick.js:80:11)
    at process._tickCallback (internal/process/next_tick.js:104:9)
From: Task: WebDriver.createSession()
    at Function.createSession (/Users/NickF/WebstormProjects/phoenix-web/node_modules/selenium-webdriver/lib/webdriver.js:777:24)
    at Function.createSession (/Users/NickF/WebstormProjects/phoenix-web/node_modules/selenium-webdriver/chrome.js:709:29)
    at createDriver (/Users/NickF/WebstormProjects/phoenix-web/node_modules/selenium-webdriver/index.js:167:33)
    at Builder.build (/Users/NickF/WebstormProjects/phoenix-web/node_modules/selenium-webdriver/index.js:623:16)
    at Hosted.getNewDriver (/Users/NickF/WebstormProjects/phoenix-web/node_modules/protractor/lib/driverProviders/driverProvider.ts:60:29)
    at Runner.createBrowser (/Users/NickF/WebstormProjects/phoenix-web/node_modules/protractor/lib/runner.ts:225:39)
    at q.then.then (/Users/NickF/WebstormProjects/phoenix-web/node_modules/protractor/lib/runner.ts:391:27)
    at _fulfilled (/Users/NickF/WebstormProjects/phoenix-web/node_modules/protractor/node_modules/q/q.js:834:54)
    at self.promiseDispatch.done (/Users/NickF/WebstormProjects/phoenix-web/node_modules/protractor/node_modules/q/q.js:863:30)
    at Promise.promise.promiseDispatch (/Users/NickF/WebstormProjects/phoenix-web/node_modules/protractor/node_modules/q/q.js:796:13)
[14:04:58] E/launcher - Process exited with error code 135
[14:04:58] gulp-angular-protractor - An error occured to stop the Webdriver standalone server
{ [Error: protractor exited with code 135]
  message: 'protractor exited with code 135',
  showStack: false,
  showProperties: true,
  plugin: 'gulp-angular-protractor',
  __safety: { toString: [Function: bound ] } }

最后,我的版本:

  Node: 6.10.3
  NPM:  4.5.0
  OS:   Mac OS 10.12.4

试图通过运行webdriver-manager然后从selenium localhost页面打开一个会话来解决,webdriver反刍了这个错误:

15:16:41.900 WARN - Exception thrown
java.util.concurrent.ExecutionException: org.openqa.selenium.WebDriverException: java.lang.reflect.InvocationTargetException
Build info: version: '3.4.0', revision: 'unknown', time: 'unknown'
System info: host: 'Nick-Fittons-MacBook-Pro.local', ip: 'fe80:0:0:0:ceb:b88:ae4e:7257%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.12.4', java.version: '1.8.0_131'
Driver info: driver.version: unknown
    at java.util.concurrent.FutureTask.report(FutureTask.java:122)
    at java.util.concurrent.FutureTask.get(FutureTask.java:192)
    at org.openqa.selenium.remote.server.DefaultSession.execute(DefaultSession.java:183)
    at org.openqa.selenium.remote.server.DefaultSession.<init>(DefaultSession.java:119)
    at org.openqa.selenium.remote.server.DefaultSession.createSession(DefaultSession.java:95)
    at org.openqa.selenium.remote.server.DefaultDriverSessions.newSession(DefaultDriverSessions.java:131)
    at org.openqa.selenium.remote.server.handler.NewSession.handle(NewSession.java:59)
    at org.openqa.selenium.remote.server.handler.NewSession.handle(NewSession.java:36)
    at org.openqa.selenium.remote.server.rest.ResultConfig.handle(ResultConfig.java:111)
    at org.openqa.selenium.remote.server.JsonHttpCommandHandler.handleRequest(JsonHttpCommandHandler.java:190)
    at org.openqa.selenium.remote.server.DriverServlet.handleRequest(DriverServlet.java:222)
    at org.openqa.selenium.remote.server.DriverServlet.doPost(DriverServlet.java:184)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
    at org.openqa.selenium.remote.server.DriverServlet.service(DriverServlet.java:150)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
    at org.seleniumhq.jetty9.servlet.ServletHolder.handle(ServletHolder.java:841)
    at org.seleniumhq.jetty9.servlet.ServletHandler.doHandle(ServletHandler.java:543)
    at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:188)
    at org.seleniumhq.jetty9.server.handler.ContextHandler.doHandle(ContextHandler.java:1228)
    at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextScope(ScopedHandler.java:168)
    at org.seleniumhq.jetty9.servlet.ServletHandler.doScope(ServletHandler.java:481)
    at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextScope(ScopedHandler.java:166)
    at org.seleniumhq.jetty9.server.handler.ContextHandler.doScope(ContextHandler.java:1130)
    at org.seleniumhq.jetty9.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
    at org.seleniumhq.jetty9.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
    at org.seleniumhq.jetty9.server.Server.handle(Server.java:564)
    at org.seleniumhq.jetty9.server.HttpChannel.handle(HttpChannel.java:320)
    at org.seleniumhq.jetty9.server.HttpConnection.onFillable(HttpConnection.java:251)
    at org.seleniumhq.jetty9.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:279)
    at org.seleniumhq.jetty9.io.FillInterest.fillable(FillInterest.java:112)
    at org.seleniumhq.jetty9.io.ChannelEndPoint$2.run(ChannelEndPoint.java:124)
    at org.seleniumhq.jetty9.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:672)
    at org.seleniumhq.jetty9.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:590)
    at java.lang.Thread.run(Thread.java:748)
Caused by: org.openqa.selenium.WebDriverException: java.lang.reflect.InvocationTargetException
Build info: version: '3.4.0', revision: 'unknown', time: 'unknown'
System info: host: 'Nick-Fittons-MacBook-Pro.local', ip: 'fe80:0:0:0:ceb:b88:ae4e:7257%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.12.4', java.version: '1.8.0_131'
Driver info: driver.version: unknown
    at org.openqa.selenium.remote.server.DefaultDriverProvider.callConstructor(DefaultDriverProvider.java:110)
    at org.openqa.selenium.remote.server.DefaultDriverProvider.newInstance(DefaultDriverProvider.java:96)
    at org.openqa.selenium.remote.server.DefaultDriverFactory.newInstance(DefaultDriverFactory.java:60)
    at org.openqa.selenium.remote.server.DefaultSession$BrowserCreator.call(DefaultSession.java:222)
    at org.openqa.selenium.remote.server.DefaultSession$BrowserCreator.call(DefaultSession.java:209)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at org.openqa.selenium.remote.server.DefaultSession$1.run(DefaultSession.java:176)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    ... 1 more
Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at org.openqa.selenium.remote.server.DefaultDriverProvider.callConstructor(DefaultDriverProvider.java:102)
    ... 9 more
Caused by: org.openqa.selenium.remote.UnreachableBrowserException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
Build info: version: '3.4.0', revision: 'unknown', time: 'unknown'
System info: host: 'Nick-Fittons-MacBook-Pro.local', ip: 'fe80:0:0:0:ceb:b88:ae4e:7257%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.12.4', java.version: '1.8.0_131'
Driver info: driver.version: ChromeDriver
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:658)
    at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:250)
    at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:236)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:137)
    at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:184)
    at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:148)
    ... 14 more
Caused by: java.lang.IllegalStateException: The process has not exited yet therefore no result is available ...
    at org.apache.commons.exec.DefaultExecuteResultHandler.getException(DefaultExecuteResultHandler.java:76)
    at org.openqa.selenium.os.UnixProcess.checkForError(UnixProcess.java:174)
    at org.openqa.selenium.os.CommandLine.checkForError(CommandLine.java:183)
    at org.openqa.selenium.remote.service.DriverService.waitUntilAvailable(DriverService.java:192)
    at org.openqa.selenium.remote.service.DriverService.start(DriverService.java:181)
    at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:78)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:637)
    ... 19 more
15:16:41.919 WARN - Exception: The process has not exited yet therefore no result is available ...

如果有人能够对我做错的事情发光,那将非常感激!

1 个答案:

答案 0 :(得分:0)

我遇到的问题是localhost没有正确定向。

确保您在/ private / etc / hosts

中有localhost链接

因为我没有......