The difference between isPresent and isElementPresent

What is the difference between ElementFinder.prototype.isPresent and ElementFinder.prototype.isElementPresent ?

It seems that isElementPresent waiting for Angular to complete, and isPresent just does the check immediately, but I can't say for sure.

Currently, isElementPresent violated due to a Protractor error , so I cannot manually check the difference.

+5
source share
1 answer

Both isPresent and isElementPresent return an "Element Finder" that:

"represents one ElementArrayFinder element (and looks more like a convenience object). As a result, everything that can be done with ElementFinder can also be done with ElementArrayFinder. ElementFinder element can be considered as a WebElement for most purposes, in particular, you can execute on these actions (for example, click, getText), since you would use WebElement.

Reader digest version: you can call methods on it or check if it exists.

isElementPresent actually calls isPresent if the locator is met, see the return statement: enter image description here

They essentially do the same thing. The protractor is built on top of WebDriver , which has its own methods. You can also use these methods in Protractor. In the event that testing Angular using these methods could lead to information failure, they provided users with Angular work-around; isElementPresent is one of those that you talked about.

tl; dr: Use isPresent . It was built for the Angular Test Pusher.

+2
source

Source: https://habr.com/ru/post/1209739/


All Articles