我正在执行我的脚本,并且在执行过程中出现“ECONNREFUSED connect ECONNREFUSED”错误。我正在执行46 it()函数,在42我的浏览器关闭,我在控制台上遇到错误。我尝试用“webdriver-manager start --standalone”启动selenium web驱动程序,但它没有帮助。 我的配置文件如下,
var HtmlScreenshotReporter = require('protractor-jasmine2-screenshot-reporter');
var reporter = new HtmlScreenshotReporter({
dest: 'target/screenshots',
filename: 'Report.html',
reportTitle: 'Execution Report',
showSummary: true,
showQuickLinks: true,
pathBuilder: function(currentSpec, suites, browserCapabilities) {
// will return chrome/your-spec-name.png
return browserCapabilities.get('browserName') + '/' + currentSpec.fullName;
}});
exports.config = {
directConnect: true,
//seleniumAddress: 'http://localhost:4444/wd/hub',
capabilities: {'browserName': 'firefox'},
// multiCapabilities: [
// {
// browserName: 'firefox'
// },
// {
// browserName: 'chrome'
// }
// ],
framework: 'jasmine',
specs: ['Login_spec2.js','Auction_spec.js'],
allScriptsTimeout: 5000000,
getPageTimeout: 5000000,
jasmineNodeOpts: {
defaultTimeoutInterval: 5000000
},
// Setup the report before any tests start
beforeLaunch: function() {
return new Promise(function(resolve){
reporter.beforeLaunch(resolve);
});
},
// Close the report after all tests finish
afterLaunch: function(exitCode) {
return new Promise(function(resolve){
reporter.afterLaunch(resolve.bind(this, exitCode));
});
},
onPrepare: function() {
var width = 1300;
var height = 1200;
browser.driver.manage().window().setSize(width,height);
//browser.driver.get(browser.baseUrl);
jasmine.getEnv().addReporter(reporter);
afterAll(function(done) {
process.nextTick(done);
})
}
};
我遇到此问题的我的it()函数如下所示,
it('42: Navigate to Followed section and verify that the accepted auction is displayed on the page.', function() {
FuncLib.SelectSubMenu.get(2).click(); //Click on New Auction Sub-menu
browser.wait(EC.presenceOf(Auction.AuctionTitleOnDetails), 20000);
var MyFollowedAuction = Auction.AuctOnMyAuctions.filter(function(MyAuction){
var Title = MyAuction.element(by.css('.title.ng-binding')).getText();
return protractor.promise.all([Title]).then(function(result){
return result[0].trim() == data.AuctionName;
})
}).last();
expect(MyFollowedAuction.isDisplayed()).toBe(true);
expect(MyFollowedAuction.element(by.repeater('file in auction.AuctionFiles')).isDisplayed()).toBe(true);
MyFollowedAuction.element(by.repeater('file in auction.AuctionFiles')).click();
browser.sleep(2000);
});
控制台日志如下,
...FF.[14:48:50] E/launcher - Error code: 135
[14:48:50] E/launcher - Error message: ECONNREFUSED connect ECONNREFUSED 127.0.0.1:61964
[14:48:50] E/launcher - Error: ECONNREFUSED connect ECONNREFUSED 127.0.0.1:61964
at ClientRequest.<anonymous> (/Users/rohitgathibandhe/npm-global/lib/node_modules/protractor/node_modules/selenium-webdriver/http/index.js:381:15)
at emitOne (events.js:96:13)
at ClientRequest.emit (events.js:188:7)
at Socket.socketErrorListener (_http_client.js:308:9)
at emitOne (events.js:96:13)
at Socket.emit (events.js:188:7)
at emitErrorNT (net.js:1271:8)
at _combinedTickCallback (internal/process/next_tick.js:74:11)
at process._tickCallback (internal/process/next_tick.js:98:9)
From: Task: WebDriver.takeScreenshot()
at Driver.schedule (/Users/rohitgathibandhe/npm-global/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver.js:377:17)
at Driver.takeScreenshot (/Users/rohitgathibandhe/npm-global/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver.js:972:17)
at ProtractorBrowser.to.(anonymous function) [as takeScreenshot] (/Users/rohitgathibandhe/npm-global/lib/node_modules/protractor/built/browser.js:60:29)
at /Users/rohitgathibandhe/node_modules/protractor-jasmine2-screenshot-reporter/index.js:437:25
at /Users/rohitgathibandhe/node_modules/lodash/index.js:3073:15
at baseForOwn (/Users/rohitgathibandhe/node_modules/lodash/index.js:2046:14)
at /Users/rohitgathibandhe/node_modules/lodash/index.js:3043:18
at Function.<anonymous> (/Users/rohitgathibandhe/node_modules/lodash/index.js:3346:13)
at Jasmine2ScreenShotReporter.specDone (/Users/rohitgathibandhe/node_modules/protractor-jasmine2-screenshot-reporter/index.js:435:9)
at dispatch (/Users/rohitgathibandhe/npm-global/lib/node_modules/protractor/node_modules/jasmine-core/lib/jasmine-core/jasmine.js:1966:28)
[14:48:50] E/launcher - Process exited with error code 135
有人可以帮我解决这个问题吗?