简体   繁体   English

量角器“错误-无法启动WebDriver会话”

[英]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: conf文件如下:

'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. 根据alecxe的回答,这是chrome二进制问题,可以通过将chrome安装在chromedriver期望的位置或指定二进制设置的可执行路径来解决。

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", 即使您正确设置了可执行文件路径,对我来说二进制文件似乎也很少: "C:/Program Files (x86)/Google/Chrome/Application/chrome.exe",

Is this correct? 这个对吗?

Alternatively, I would try this 或者,我会尝试这个

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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