Jasmine ptor.findElements始终返回true
我有以下代码,它从不运行错误部分Jasmine ptor.findElements始终返回true,jasmine,protractor,Jasmine,Protractor,我有以下代码,它从不运行错误部分 ptor.findElements(protractor.By.css(elementCss)).then(function (elems) { element = elems; elementFound = true; // if element.all(...).c
ptor.findElements(protractor.By.css(elementCss)).then(function (elems) {
element = elems;
elementFound = true;
// if element.all(...).count()
console.log("inside then clause , Element Found");
}, function (err) {
console.error("waiting for element( " + elementCss + " ) to be found " + currentCount + "/" + timeout);
}); //ptor.findElement
即使元素css='abc',有一些垃圾值,它也总是解析为then子句
而不是拒绝/错误,因为这是一个垃圾css名称
另一方面,findElement的行为与预期的一样。我在这里遗漏了什么吗?如果给定选择器找不到元素,findElement的API将返回en error
如果选择器与任何元素都不匹配,findElements的API将返回一个空列表
来自findElement:
If the element cannot be found, a bot.ErrorCode.NO_SUCH_ELEMENT result will be returned by the driver