【问题标题】:protractor can not start webdriver session量角器无法启动 webdriver 会话
【发布时间】:2018-04-09 05:10:42
【问题描述】:

请帮忙!

你好

我无法运行量角器测试,以为 chrome 弹出一个空白页

在错误消息中显示 webdriver 无法启动

✗ protractor config.js --troubleshoot true
[16:32:54] D/launcher - Running with --troubleshoot
[16:32:54] D/launcher - Protractor version: 5.2.0
[16:32:54] D/launcher - Your base url for tests is http://localhost:9000
(node:977) [DEP0022] DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpdir() instead.
[16:32:54] I/launcher - Running 1 instances of WebDriver
[16:32:54] I/hosted - Using the selenium server at http://127.0.0.1:4444/wd/hub
[16:32:54] E/runner - Unable to start a WebDriver session.
(node:977) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): WebDriverError: Cannot define class using reflection
(node:977) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
[16:32:54] E/launcher - Error: WebDriverError: Cannot define class using reflection
    at Object.checkLegacyResponse (/home/lzt/.nvm/versions/node/v8.1.1/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/error.js:546:15)
    at parseHttpResponse (/home/lzt/.nvm/versions/node/v8.1.1/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/http.js:509:13)
    at doSend.then.response (/home/lzt/.nvm/versions/node/v8.1.1/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/http.js:441:30)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:169:7)
[16:32:54] E/launcher - Process exited with error code 100

错误报告

  • 节点版本:8.1.1
  • 量角器版本:5.2.0
  • 角度版本:1
  • 浏览器:chrom
  • 操作系统和版本ubuntu
  • 你的量角器配置文件

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const protractor_1 = require("protractor");
exports.config = {
    seleniumAddress: 'http://127.0.0.1:4444/wd/hub',
    SELENIUM_PROMISE_MANAGER: false,
    baseUrl: 'http://localhost:9000',
    capabilities: {
        browserName: 'chrome'
    },
    jasmineNodeOpts: {
        defaultTimeoutInterval: 25000
    },
    framework: 'custom',
    frameworkPath: require.resolve('protractor-cucumber-framework'),
    specs: [
        '../../features/login/login.feature'
    ],
    onPrepare: () => {
        protractor_1.browser.ignoreSynchronization = true;
        protractor_1.browser.manage().window().setSize(1600, 1000);
    },
    cucumberOpts: {
        compiler: "ts:ts-node/register",
        strict: true,
        format: ['pretty'],
        require: [
            '../../features/**/*.ts'
            // '../../stepdefinitions/loginPage.ts',
            // '../../support/*.ts'
        ]
    }
};

  

【问题讨论】:

    标签: angularjs node.js selenium protractor


    【解决方案1】:

    您必须运行本地量角器安装。

    npm install protractor --save-dev

    将此添加到 package.json:

    "scripts": { "update-webdriver": "webdriver-manager update", "protractor": "protractor config.js", },

    然后运行:

    npm run update-webdriver npm run protractor

    【讨论】:

      【解决方案2】:
      • 尝试通过从代码中删除 seleniumAddress: 'http://127.0.0.1:4444/wd/hub', 来运行。

      • 安装 LTS 版本的 nodejs 比安装最新版本。

      【讨论】:

        【解决方案3】:

        您是否在测试运行前更新了 webdriver-manager? 我们试试webdriver-manager update

        您是否尝试在节点 v6 上运行它?

        https://github.com/angular/protractor#compatibility

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2017-12-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2017-01-02
          相关资源
          最近更新 更多