Thursday, 9 May 2019

Interview | @CacheLookup - in Page Object Model | Page Factory


@CacheLookup, as the name suggests helps us control when to cache a WebElement and when not to.

This annotation when applied over a WebElement instructs Selenium to keep a cache of the WebElement instead of searching for the WebElement every time from the WebPage. This helps us save a lot of time.

Syntax:
 @FindBy(how = How.NAME, using = "firstname")
 @CacheLookup
 public WebElement firsNameCached;