Protractor error selenium spring boot

2019-06-10 02:26发布

问题:

vegan@vegan:~/hb-productupload/gateway/src/test/javascript$ gulp protractor  
[15:47:24] Working directory changed to ~/hb-productupload/gateway
[15:47:51] Using gulpfile ~/hb-productupload/gateway/gulpfile.js
[15:47:51] Starting 'protractor'...
Using ChromeDriver directly...
[launcher] Running 1 instances of WebDriver

/home/vegan/hb-productupload/gateway/node_modules/selenium-webdriver/http/index.js:174
      callback(new Error(message));
               ^
Error: ECONNREFUSED connect ECONNREFUSED 127.0.0.1:47841
    at ClientRequest.<anonymous> (/home/vegan/hb-productupload/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/hb-productupload/gateway/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:157:22)
    at Function.webdriver.WebDriver.createSession (/home/vegan/hb-productupload/gateway/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:131:30)
    at new Driver (/home/vegan/hb-productupload/gateway/node_modules/selenium-webdriver/chrome.js:810:36)
    at [object Object].DirectDriverProvider.getNewDriver (/home/vegan/hb-productupload/gateway/node_modules/gulp-protractor/node_modules/protractor/lib/driverProviders/direct.js:68:16)
    at [object Object].Runner.createBrowser (/home/vegan/hb-productupload/gateway/node_modules/gulp-protractor/node_modules/protractor/lib/runner.js:186:37)
    at /home/vegan/hb-productupload/gateway/node_modules/gulp-protractor/node_modules/protractor/lib/runner.js:276:21
    at _fulfilled (/home/vegan/hb-productupload/gateway/node_modules/gulp-protractor/node_modules/q/q.js:797:54)
    at self.promiseDispatch.done (/home/vegan/hb-productupload/gateway/node_modules/gulp-protractor/node_modules/q/q.js:826:30)
    at Promise.promise.promiseDispatch (/home/vegan/hb-productupload/gateway/node_modules/gulp-protractor/node_modules/q/q.js:759:13)
    at /home/vegan/hb-productupload/gateway/node_modules/gulp-protractor/node_modules/q/q.js:525:49
[launcher] Process exited with error code 1
[15:47:59] gulp-notify: [JHipster Gulp Build] Error: protractor exited with code 1
[15:47:59] Finished 'protractor' after 7.34 s
[15:47:59] E2E Tests failed

I am trying to run a simple

i updated chrme driver.

Then i made

npm install
bower install
gulp install

but did not work when i run

gulp protractor

I run with gulp for project but also i downloaded to my ubuntu and i can run as local. But same error for that local happens when i run

protractor protractor.conf.js

Ysterday i could run both, i made upgrade. now i cant work both.

this is conf file

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: 20000,

    suites: {
        login: './e2e/account/login/*.js'
    },

    capabilities: {
        'browserName': 'chrome'
    },

    directConnect: true,


    framework: 'jasmine2',

    jasmineNodeOpts: {
        showColors: true,
        defaultTimeoutInterval: 30000
    },


    onPrepare: function () {

        // Disable animations so e2e tests run more quickly
        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().setSize(1600, 1280);


    }
};

this is in protractor config

{
  "webdriverVersions": {
    "selenium": "2.51.0",
    "chromedriver": "2.25",
    "iedriver": "2.51.0"
  }
}

it was not 2.25 i updated but still same.

回答1:

I changed chrome driver and selenium driver to latest and it worked.