簡體   English   中英

量角器“錯誤-無法啟動WebDriver會話”

[英]protractor “ERROR - Unable to start a WebDriver session”

我在用角度編寫的單頁應用程序上進行了一些測試。 測試在量角器中。

它們在構建之前就已經運行了,但是現在我將所有它們都移到了一個分支,但是有些地方壞了,當我運行測試時,我得到了:

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

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
    }
};

任何有關如何解決此問題的建議將不勝感激。

謝謝!

根據alecxe的回答,這是chrome二進制問題,可以通過將chrome安裝在chromedriver期望的位置或指定二進制設置的可執行路徑來解決。

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

在這里查看他的答案

即使您正確設置了可執行文件路徑,對我來說二進制文件似乎也很少: "C:/Program Files (x86)/Google/Chrome/Application/chrome.exe",

這個對嗎?

或者,我會嘗試這個

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM