简体   繁体   中英

protractor “ERROR - Unable to start a WebDriver session”

I have some it tests on my single-page-app written in angular. the tests are in protractor.

they ran during the build before, but now that I moved all of them to a branch something got broken and when I run the tests I'm getting:

Running "protractor:normal" (protractor) task
Starting selenium standalone server...
[launcher] Running 1 instances of WebDriver
Selenium standalone server started at http://172.31.9.226:23730/wd/hub
ERROR - Unable to start a WebDriver session.

c:\projects\blog-manager\node_modules\protractor\node_modules\selenium-    webdriver\lib\atoms\error.js:113
var template = new Error(this.message);
             ^
Warning: Protractor test(s) failed. Exit code: 1 Use --force to continue.

Aborted due to warnings.

Process finished with exit code 6

the conf file is as follows:

'use strict';

module.exports.config = {
    allScriptsTimeout: 60000,

    baseUrl: 'http://localhost:9000/',

    specs: [
            process.cwd() + '/test/spec/e2e/**/*.js'//,
           // process.cwd() + '/test/e2e/spec/**/*.js'
    ],

    framework: 'jasmine',

    capabilities: {
        browserName: 'chrome',
        "chromeOptions": {
            binary: "C:/Program Files      (x86)/Google/Chrome/Application/chrome.exe",
            args: [],
           extensions: [],
        }
    },

    onPrepare: function () {
        // Disable animations so e2e tests run more quickly
        var disableNgAnimate = function () {
            angular.module('disableNgAnimate', []).run(function ($animate) {
                $animate.enabled(false);
            });
        };

        browser.addMockModule('disableNgAnimate', disableNgAnimate);

        // Store the name of the browser that's currently being used.
        browser.getCapabilities().then(function (caps) {
            browser.params.browser = caps.get('browserName');
        });
    },

    jasmineNodeOpts: {
        defaultTimeoutInterval: 300000
    }
};

any suggestions on how to solve this would be much appreciated.

Thanks!

According to alecxe's answer it's chrome binary issue which can be solved by installing chrome in same place as chromedriver expects to be or specifying the executable path to the binary settings.

capabilities: {
    "browserName": "chrome",
    "chromeOptions": {
        binary: "D:/Program Files/Chrome/chrome.exe",
        args: [],
        extensions: [],
    }
},

See his answer here

Even though you are setting the executable path correctly it seems little off to me binary: "C:/Program Files (x86)/Google/Chrome/Application/chrome.exe",

Is this correct?

Alternatively, I would try this

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM