<分区>
ElementFinder.prototype.isPresent 之间有什么区别?和 ElementFinder.prototype.isElementPresent ?
听起来像 isElementPresent
等待 Angular 完成,而 isPresent
只是立即检查,但我不能确定。
目前,isElementPresent
根据 Protractor bug 被破坏,所以我无法手动测试差异。
<分区>
ElementFinder.prototype.isPresent 之间有什么区别?和 ElementFinder.prototype.isElementPresent ?
听起来像 isElementPresent
等待 Angular 完成,而 isPresent
只是立即检查,但我不能确定。
目前,isElementPresent
根据 Protractor bug 被破坏,所以我无法手动测试差异。
最佳答案
isPresent
和 isElementPresent
都返回 "Element Finder"其中:
"represents a single element of an ElementArrayFinder (and is more like a convenience object). As a result, anything that can be done with an ElementFinder, can also be done using an ElementArrayFinder. The ElementFinder can be treated as a WebElement for most purposes, in particular, you may perform actions (i.e. click, getText) on them as you would a WebElement."
读者文摘版本:您可以对其调用方法或测试它是否存在。
isElementPresent
如果满足定位器,实际上会调用 isPresent
,请看返回语句:
他们基本上做同样的事情。 Protractor 建立在 WebDriver 之上,它有自己的方法。您也可以在 Protractor 中使用这些方法。如果使用这些方法测试 Angular 可能会导致错误信息,他们为用户提供了 Angular 解决方法;由于您提到的原因,isElementPresent
就是其中之一。
tl;dr:使用 isPresent
。它是为 Protractor 构建的,用于测试 Angular。
关于javascript - isPresent 和 isElementPresent 之间的区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27611269/
相关文章:
javascript - 使用 canvas.captureStream() 捕获带有 alpha channel 的视频
javascript - 压缩 javascript 和 css 文件的 yui-compressor 是如何工作的?
javascript - 使用数据表我想仅使用第一个字母进行搜索
google-chrome - 在不改变比例的情况下调整 Chrome 响应模式窗口的大小
javascript - Protractor Angular 2 失败 : unknown error: angular is not defined
angular - 我如何捕获 ng-reflect-value 的值来测试其预期值?
angular - 在 headless 模式下,元素不可点击。但是当我们从 protractor.conf.js 中删除 headless 时,它工作正常。
javascript - 使用 Object.create(),范例是否应该将方法附加到它们的 'prototype' 属性?