【发布时间】:2023-03-09 01:28:01
【问题描述】:
我想检查页面上是否存在元素(不应该存在),如果不存在则继续。
driver.wait(function() {
fieldBool = driver.isElementPresent(webdriver.By.id("someId"));
return fieldBool;
}, timeout).then(function(b) {
assert.equal(false, b, "message");
});
我希望 fieldBool 为 false,但测试停止(超时或不存在此类元素)。
【问题讨论】:
-
我找到了这个例子:
expect(element(by.css('#logout')).isPresent()).toBeTruthy();。您可以在此处查看该项目:stackoverflow.com/questions/21245418/… -
所以我应该使用
toBeFalsy()?