无法在吞咽时运行量角器(ECONNREFUSED连接ECONNREFUSED)



我以前可以运行它。但现在我不能了。它在一个项目中。我的朋友从git latst存储库中获得了这个项目(这也是我导入的方式),他可以在网关下使用gulp-de量角器qa运行量角器。但对我来说,它会给出错误

vegan@vegan:~/xxx-yyyy/gateway$ gulp protractor qa
[16:04:08] Using gulpfile ~/xxx-yyyy/gateway/gulpfile.js
[16:04:08] Starting 'protractor'...
[16:04:08] Starting 'qa'...
[16:04:08] Finished 'qa' after 67 μs
Using ChromeDriver directly...
[launcher] Running 1 instances of WebDriver
/home/vegan/xxx-yyyy/gateway/node_modules/selenium-webdriver/http/index.js:174
callback(new Error(message));
^
Error: ECONNREFUSED connect ECONNREFUSED 127.0.0.1:40886
at ClientRequest.<anonymous> (/home/vegan/xxx-yyyy/gateway/node_modules/selenium-webdriver/http/index.js:174:16)
at emitOne (events.js:90:13)
at ClientRequest.emit (events.js:182:7)
at Socket.socketErrorListener (_http_client.js:306:9)
at emitOne (events.js:90:13)
at Socket.emit (events.js:182:7)
at emitErrorNT (net.js:1265:8)
at _combinedTickCallback (internal/process/next_tick.js:74:11)
at process._tickCallback (internal/process/next_tick.js:98:9)
From: Task: WebDriver.createSession()
at Function.webdriver.WebDriver.acquireSession_ (/home/vegan/xxx-yyyy/gateway/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:157:22)
at Function.webdriver.WebDriver.createSession (/home/vegan/xxx-yyyy/gateway/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:131:30)
at new Driver (/home/vegan/xxx-yyyy/gateway/node_modules/selenium-webdriver/chrome.js:810:36)
at [object Object].DirectDriverProvider.getNewDriver (/home/vegan/xxx-yyyy/gateway/node_modules/gulp-protractor/node_modules/protractor/lib/driverProviders/direct.js:68:16)
at [object Object].Runner.createBrowser (/home/vegan/xxx-yyyy/gateway/node_modules/gulp-protractor/node_modules/protractor/lib/runner.js:186:37)
at /home/vegan/xxx-yyyy/gateway/node_modules/gulp-protractor/node_modules/protractor/lib/runner.js:276:21
at _fulfilled (/home/vegan/xxx-yyyy/gateway/node_modules/gulp-protractor/node_modules/q/q.js:797:54)
at self.promiseDispatch.done (/home/vegan/xxx-yyyy/gateway/node_modules/gulp-protractor/node_modules/q/q.js:826:30)
at Promise.promise.promiseDispatch (/home/vegan/xxx-yyyy/gateway/node_modules/gulp-protractor/node_modules/q/q.js:759:13)
at /home/vegan/xxx-yyyy/gateway/node_modules/gulp-protractor/node_modules/q/q.js:525:49
[launcher] Process exited with error code 1
[16:04:10] gulp-notify: [JHipster Gulp Build] Error: protractor exited with code 1
[16:04:10] Finished 'protractor' after 2.41 s
[16:04:10] E2E Tests failed

我没有接触量角器的任何conf文件。它们是默认值。

在json 包中

},
"engines": {
"node": "^4.3"
},

这是174 的错误线

request.on('error', function(e) {
if (e.code === 'ECONNRESET') {
setTimeout(function() {
sendRequest(options, callback, opt_data, opt_proxy);
}, 15);
} else {
var message = e.message;
if (e.code) {
message = e.code + ' ' + message;
}
callback(new Error(message));
}
});

这在selenumwebdriver 中的packagejson中

{
"_args": [
[
"selenium-webdriver@https://registry.npmjs.org/selenium-webdriver/-/selenium-webdriver-2.48.2.tgz",
"/home/vegan/xxx-yyyy/gateway"
]
],
"_from": "selenium-webdriver@2.48.2",
"_id": "selenium-webdriver@2.48.2",
"_inCache": true,
"_location": "/selenium-webdriver",
"_phantomChildren": {
"bufferutil": "1.2.1",
"options": "0.0.6",
"ultron": "1.0.2",
"utf-8-validate": "1.2.2",
"xmlbuilder": "4.2.1"
},
"_requested": {
"name": "selenium-webdriver",
"raw": "selenium-webdriver@https://registry.npmjs.org/selenium-webdriver/-/selenium-webdriver-2.48.2.tgz",
"rawSpec": "https://registry.npmjs.org/selenium-webdriver/-/selenium-webdriver-2.48.2.tgz",
"scope": null,
"spec": "https://registry.npmjs.org/selenium-webdriver/-/selenium-webdriver-2.48.2.tgz",
"type": "remote"
},
"_requiredBy": [
"/gulp-protractor/protractor",
"/protractor"
],
"_resolved": "https://registry.npmjs.org/selenium-webdriver/-/selenium-webdriver-2.48.2.tgz",
"_shasum": "b26a4631430d0a9f36284ee0cfe09676e8f348ca",
"_shrinkwrap": null,
"_spec": "selenium-webdriver@https://registry.npmjs.org/selenium-webdriver/-/selenium-webdriver-2.48.2.tgz",
"_where": "/home/vegan/xx-yyyy/gateway",
"bugs": {
"url": "https://github.com/SeleniumHQ/selenium/issues"
},
"dependencies": {
"adm-zip": "0.4.4",
"rimraf": "^2.2.8",
"tmp": "0.0.24",
"ws": "^0.8.0",
"xml2js": "0.4.4"
},
"description": "The official WebDriver JavaScript bindings from the Selenium project",
"devDependencies": {
"express": "^4.11.2",
"mocha": ">= 1.21.x",
"multer": "^0.1.7",
"promises-aplus-tests": "^2.1.0",
"serve-index": "^1.6.1"
},
"engines": {
"node": ">= 0.12.x"
},
"homepage": "https://github.com/SeleniumHQ/selenium",
"keywords": [
"automation",
"selenium",
"testing",
"webdriver",
"webdriverjs"
],
"license": "Apache-2.0",
"main": "./index",
"name": "selenium-webdriver",
"optionalDependencies": {},
"readme": "# selenium-webdrivernnSelenium is a browser automation library. Most often used for testingnweb-applications, Selenium may be used for any task that requires automatingninteraction with the browser.nn## InstallationnnSelenium supports Node `0.12.x` and `4.x`. Users on Node `0.12.x` must run withnthe --harmony flag. Selenium may be installed via npm withnn    npm install selenium-webdrivernnOut of the box, Selenium includes everything you need to work with Firefox. Younwill need to download additional components to work with the other majornbrowsers. The drivers for Chrome, IE, PhantomJS, and Opera are all standalonenexecutables that should be placed on yourn[PATH](http://en.wikipedia.org/wiki/PATH_%28variable%29). The SafariDrivernbrowser extension should be installed in your browser before using Selenium; wenrecommend disabling the extension when using the browser without Selenium orninstalling the extension in a profile only used for testing.nn| Browser           | Component                          |n| ----------------- | ---------------------------------- |n| Chrome            | [chromedriver(.exe)][chrome]       |n| Internet Explorer | [IEDriverServer.exe][release]      |n| PhantomJS         | [phantomjs(.exe)][phantomjs]       |n| Opera             | [operadriver(.exe)][opera]         |n| Safari            | [SafariDriver.safariextz][release] |nn## UsagennThe sample below and others are included in the `example` directory. You maynalso find the tests for selenium-webdriver informative.nn    var webdriver = require('selenium-webdriver'),n        By = require('selenium-webdriver').By,n        until = require('selenium-webdriver').until;nn    var driver = new webdriver.Builder()n        .forBrowser('firefox')n        .build();nn    driver.get('http://www.google.com/ncr');n    driver.findElement(By.name('q')).sendKeys('webdriver');n    driver.findElement(By.name('btnG')).click();n    driver.wait(until.titleIs('webdriver - Google Search'), 1000);n    driver.quit();nn### Using the Builder APInnThe `Builder` class is your one-stop shop for configuring new WebDriverninstances. Rather than clutter your code with branches for the various browsers,nthe builder lets you set all options in one flow. When you calln`Builder#build()`, all options irrelevant to the selected browser are dropped:nn    var webdriver = require('selenium-webdriver'),n        chrome = require('selenium-webdriver/chrome'),n        firefox = require('selenium-webdriver/firefox');nn    var driver = new webdriver.Builder()n        .forBrowser('firefox')n        .setChromeOptions(/* ... */)n        .setFirefoxOptions(/* ... */)n        .build();nnWhy would you want to configure options irrelevant to the target browser? Then`Builder`'s API defines your _default_ configuration. You can change the targetnbrowser at runtime through the `SELENIUM_BROWSER` environment variable. Fornexample, the `example/google_search.js` script is configured to run againstnFirefox. You can run the example against other browsers just by changing thenruntime environmentnn    # cd node_modules/selenium-webdrivern    node example/google_searchn    SELENIUM_BROWSER=chrome node example/google_searchn    SELENIUM_BROWSER=safari node example/google_searchnn### The Standalone Selenium ServernnThe standalone Selenium Server acts as a proxy between your script and thenbrowser-specific drivers. The server may be used when running locally, but it'snnot recommend as it introduces an extra hop for each request and will slownthings down. The server is required, however, to use a browser on a remote hostn(most browser drivers, like the IEDriverServer, do not accept remotenconnections).nnTo use the Selenium Server, you will need to install then[JDK](http://www.oracle.com/technetwork/java/javase/downloads/index.html) andndownload the latest server from [Selenium][release]. Once downloaded, run thenserver withnn    java -jar selenium-server-standalone-2.45.0.jarnnYou may configure your tests to run against a remote server through the BuildernAPI:nn    var driver = new webdriver.Builder()n        .forBrowser('firefox')n        .usingServer('http://localhost:4444/wd/hub')n        .build();nnOr change the Builder's configuration at runtime with the `SELENIUM_REMOTE_URL`nenvironment variable:nn    SELENIUM_REMOTE_URL="http://localhost:4444/wd/hub" node script.jsnnYou can experiment with these options using the `example/google_search.js`nscript provided with `selenium-webdriver`.nn## DocumentationnnAPI documentation is included in the `docs` directory and is also availablenonline from the [Selenium project][api]. Addition resources includenn- the #selenium channel on freenode IRCn- the [selenium-users@googlegroups.com][users] listn- [SeleniumHQ](http://www.seleniumhq.org/docs/) documentationnn## ContributingnnContributions are accepted either through [GitHub][gh] pull requests or patchesnvia the [Selenium issue tracker][issues]. You must sign ourn[Contributor License Agreement][cla] before your changes will be accepted.nn## IssuesnnPlease report any issues using the [Selenium issue tracker][issues]. When usingnthe issue trackernn- __Do__ include a detailed description of the problem.n- __Do__ include a link to a [gist](http://gist.github.com/) with anyn    interesting stack traces/logs (you may also attach these directly to the bugn    report).n- __Do__ include a [reduced test case][reduction]. Reporting "unable to findn    element on the page" is _not_ a valid report - there's nothing for us ton    look into. Expect your bug report to be closed if you do not provide enoughn    information for us to investigate.n- __Do not__ use the issue tracker to submit basic help requests. All helpn    inquiries should be directed to the [user forum][users] or #selenium IRCn    channel.n- __Do not__ post empty "I see this too" or "Any updates?" comments. Thesen    provide no additional information and clutter the log.n- __Do not__ report regressions on closed bugs as they are not activelyn    monitored for upates (especially bugs that are >6 months old). Please open an    new issue and reference the original bug in your report.nn## LicensennLicensed to the Software Freedom Conservancy (SFC) under onenor more contributor license agreements.  See the NOTICE filendistributed with this work for additional informationnregarding copyright ownership.  The SFC licenses this filento you under the Apache License, Version 2.0 (then"License"); you may not use this file except in compliancenwith the License.  You may obtain a copy of the License atnnhttp://www.apache.org/licenses/LICENSE-2.0nnUnless required by applicable law or agreed to in writing,nsoftware distributed under the License is distributed on ann"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANYnKIND, either express or implied.  See the License for thenspecific language governing permissions and limitationsnunder the License.nn[api]: http://seleniumhq.github.io/selenium/docs/api/javascript/n[cla]: http :/ /go o.gl/qC50Rn[chrome]: http://chromedriver.storage.googleapis.com/index.htmln[gh]: https://github.com/SeleniumHQ/selenium/n[issues]: https://github.com/SeleniumHQ/selenium/issuesn[opera]: https://github.com/operasoftware/operachromiumdriver/releasesn[phantomjs]: http://phantomjs.org/n[reduction]: http://www.webkit.org/quality/reduction.htmln[release]: http://selenium-release.storage.googleapis.com/index.htmln[users]: https://groups.google.com/forum/#!forum/selenium-usersn",
"readmeFilename": "README.md",
"repository": {
"type": "git",
"url": "git+https://github.com/SeleniumHQ/selenium.git"
},
"scripts": {
"test": "mocha --harmony -t 600000 --recursive test"
},
"version": "2.48.2"
}

这些是版本

vegan@vegan:~/xx-yyyy/gateway$ node -v
v5.12.0
vegan@vegan:~/xx-yyyy/gateway$ npm -v
3.8.6

我的朋友也有这个版本,但他可以运行,我也可以运行到lasst周。我不知道发生了什么事。我删除了节点模块,重新设置了所有模块,但没有工作。

我不知道我能提供什么信息。

我也试过这个

https://stackoverflow.com/a/34758398/6804200

已将configjson更改为此

{
"webdriverVersions": {
"seleniumServerJar": './node_modules/protractor/selenium/selenium-server-standalone-2.51.0.jar',
"chromedriver": "2.21",
"iedriver": "2.51.0"
}
}

但一切都没有改变。

我也做了npm update

吞咽量角器是

gulp.task(
'protractor', function () {

configObj['args'] = [];//to be able to add multiple parameters
if (argv.suite) {
configObj['args'].push(
'--suite',
argv.suite
);
}
return gulp.src([])
.pipe(plumber({errorHandler: handleErrors}))
.pipe(protractor(configObj))
.on(
'error', function () {
gutil.log('E2E Tests failed');
process.exit(1);
}
);
}
);
var configObj = {
configFile: config.test + 'protractor.conf.js'
};

dractorconf是

var HtmlScreenshotReporter = require("protractor-jasmine2-screenshot-reporter");
var JasmineReporters = require('jasmine-reporters');
var prefix = 'src/test/javascript/'.replace(/[^/]+/g, '..');

exports.config = {
chromeDriver: prefix + 'node_modules/protractor/selenium/chromedriver',
allScriptsTimeout: 240000,
suites: {
register: './e2e/account/register/*.js',
login: './e2e/account/login/*.js'
},
capabilities: {
'browserName': 'chrome'
},
directConnect: true,
framework: 'jasmine2',
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 240000
},
onPrepare: function () {
var disableNgAnimate = function () {
angular
.module('disableNgAnimate', [])
.run(
[
'$animate',
function ($animate) {
$animate.enabled(false);
}
]
);
};
var disableCssAnimate = function () {
angular
.module('disableCssAnimate', [])
.run(
function () {
var style = document.createElement('style');
style.type = 'text/css';
style.innerHTML = 'body * {' +
'-webkit-transition: none !important;' +
'-moz-transition: none !important;' +
'-o-transition: none !important;' +
'-ms-transition: none !important;' +
'transition: none !important;' +
'}';
document.getElementsByTagName('head')[0].appendChild(style);
}
);
};
browser.addMockModule('disableNgAnimate', disableNgAnimate);
browser.addMockModule('disableCssAnimate', disableCssAnimate);
browser.driver.manage().window().maximize();

}
};

qa 的吞咽任务

gulp.task('qa', function () {
argv.baseUrl = qaurl;
configObj['args'].push(
'--baseUrl',
argv.baseUrl
);
});

我在npm安装时得到了这个

npm WARN生命周期gateway@0.0.0~postinstall:无法在wd%s%s中运行(单词=%s)gateway@0.0.0网络驱动程序管理器更新/home/vegate/xx-yyy/gateway npm WARN可选跳过失败可选dependency/chokidar/fsevents:npm WARN notsup与不兼容您的操作系统或体系结构:fsevents@1.0.17

我也得到了这个

vegan@vegan:~/xx-yyy/gateway$ sudo npm install -g protractor
npm WARN deprecated minimatch@0.3.0: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
/usr/bin/protractor -> /usr/lib/node_modules/protractor/bin/protractor
/usr/bin/webdriver-manager -> /usr/lib/node_modules/protractor/bin/webdriver-manager
/usr/lib
└─┬ protractor@5.0.0 
└── source-map-support@0.4.11 

这是一个春季启动项目。它需要吞咽。这个项目不需要准备好就能运行量角器。

删除&重新安装npm、gulp、nodejs。

你能更新gulp-de量角器qa插件吗。同时我希望你也在使用量角器更新。将gulp量角器更新到3.0.0版本npm更新吞咽量角器&试试看,它应该行得通。

最新更新