E /启动器-进程退出,错误代码为100

时间:2019-05-16 17:16:20

标签: protractor

我是量角器的新手。我遵循了https://www.protractortest.org/#/中提到的步骤 当我运行量角器conf.js命令时,浏览器会立即打开和关闭。 我在命令行中遇到以下错误:

[22:41:08] E /启动程序-进程退出,错误代码为100

我尝试通过在conf.js中添加功能来在Firefox中执行

文件内容:

spec.js

import { element } from "protractor";

describe('angularjs homepage todo list', function() {
  it('should add a todo', async function() {
    await browser.get('https://angularjs.org');

    await element(by.model('todoList.todoText')).sendKeys('write first protractor test');
    await element(by.css('[value="add"]')).click();

    var todoList = element.all(by.repeater('todo in todoList.todos'));
    expect(await todoList.count()).toEqual(3);
    expect(await todoList.get(2).getText()).toEqual('write first protractor test');

    // You wrote your first test, cross it off the list
    await todoList.get(2).element(by.css('input')).click();
    var completedAmount = element.all(by.css('.done-true'));
    expect(await completedAmount.count()).toEqual(2);
  });
});

conf.js

exports.config = {
    seleniumAddress: 'http://localhost:4444/wd/hub',
    specs: ['spec.js'],
    //useAllAngular2AppRoots: true,
    //directConnect=true,

    /* capabilities: {
        'browserName': 'firefox'
      } */
};

1 个答案:

答案 0 :(得分:0)

如我的评论中所述,文档尚未更新以反映以下事实:在最新版本中,默认情况下禁用了控制流(以前用于处理量角器的异步特性)。现在有必要亲自处理这些承诺,async/await样式是最简单的长期方法。

下面是使用异步/等待样式的主站点示例。

describe('angularjs homepage todo list', function() {
    it('should add a todo', async function() {
      await browser.get('https://angularjs.org');

      await element(by.model('todoList.todoText')).sendKeys('write first protractor test');
      await element(by.css('[value="add"]')).click();

      var todoList = element.all(by.repeater('todo in todoList.todos'));
      expect(await todoList.count()).toEqual(3);
      expect(await todoList.get(2).getText()).toEqual('write first protractor test');

      // You wrote your first test, cross it off the list
      await todoList.get(2).element(by.css('input')).click();
      var completedAmount = element.all(by.css('.done-true'));
      expect(await completedAmount.count()).toEqual(2);
    });
  });

我不确定这是造成您问题的原因,但它是开始进行故障排除的好地方。

注意:仅当量角器版本高于6.0时才会影响