【问题标题】:How can I check if an element is require using Protractor in angular2?如何检查是否需要在 angular2 中使用量角器?
【发布时间】:2016-12-31 03:25:38
【问题描述】:

如何在角度 2 中使用量角器检查元素(输入字段或下拉列表)是否需要?

    expect(helpers.hasClass(element(by.id('datasourceName')), 'ng-invalid')).toBe(true);

我正在使用下面的助手: https://www.npmjs.com/package/protractor-helpers

不知道它是否正确。

【问题讨论】:

    标签: protractor


    【解决方案1】:

    找到输入并使用getAttribute方法检查:

    expect(inputElement.getAttribute("required")).toBe("true");
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-08-09
      • 2016-10-10
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多