【发布时间】:2015-05-07 11:35:35
【问题描述】:
在量角器 2.0 中,如果显示一个元素,我将签入 expect()。我期待一个错误,但奇怪的是我收到以下错误:
NoSuchElementError: No element found using locator: By.id("userForm")
我的代码是:
describe('closeModal', function() {
it('should close the alert that appears after registration.', function(){
element(by.id('closeAlertModalButton')).click();
expect(element(by.id('userForm')).isDisplayed()).toBeFalsy();
});
});
我知道我收到该错误是因为页面上不再存在元素(这是我要确认的内容),但我不应该得到错误而不是错误吗?
【问题讨论】:
-
您最好使用 isElementPresent 或 isPresent - 您遇到的错误是 WebDriver 逻辑的一部分
标签: javascript angularjs jasmine protractor angularjs-e2e