What is CacheLookup annotation in PageFactory

0 votes
What is @CacheLookup annotation in PageFactory?
Jul 5, 2019 in Selenium by Abhay
6,956 views

1 answer to this question.

0 votes

Hey Abhay, PageFactory annotation @CacheLookup is used to mark the WebElements once located so that the same instance in the DOM can always be used. CacheLookup attribute can be used to instruct the InitElements() method to cache the element once its located and so that it will not be searched over and over again. 

It is useful when the elements that are always going to be there. For AJAX based applications, it may not work where the DOM changes based on user action on the page, otherwise every time when we use a Web Element the WebDriver will go and search it again. For example:

@FindBy(id="firstname") 

@CacheLookup 

private WebElement userName;
answered Jul 5, 2019 by Abha
• 28,140 points

Related Questions In Selenium

0 votes
1 answer

What is the use of @listener annotation in TestNG?

 @listeners are used to configure reports and ...READ MORE

answered Jan 2, 2019 in Selenium by Shuvodip
2,767 views
0 votes
2 answers

What is the role of TestNG & JUnit frameworks in Selenium?

TestNG and JUnit are test frameworks . it ...READ MORE

answered Sep 4, 2020 in Selenium by Sri
• 3,190 points
2,844 views
0 votes
1 answer

What is the difference between dot and text() in XPath?

Even though there is some difference between ...READ MORE

answered Apr 25, 2018 in Selenium by king_kenny
• 3,710 points
8,270 views
0 votes
2 answers

what is the need of xpath when you have attributes like id ,class,name in selenium?

some of the controls not have id ...READ MORE

answered Sep 4, 2020 in Selenium by Sri
• 3,190 points
1,768 views
0 votes
2 answers

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,500 points
13,567 views
0 votes
2 answers

Problem while using InternetExplorerDriver in Selenium WebDriver

enable trusted connection  in internet explorer by ...READ MORE

answered Aug 31, 2020 in Selenium by Sri
• 3,190 points
9,084 views
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,910 points
7,178 views
0 votes
2 answers

How to use such xpath to find web elements

xpath are two types. 1) Absolute XPath:    /html/b ...READ MORE

answered Sep 3, 2020 in Selenium by Sri
• 3,190 points
7,840 views
0 votes
1 answer

What is PageFactory in Selenium?

Hi Shruti, The PageFactory class in Selenium is an extension ...READ MORE

answered May 13, 2019 in Selenium by Abha
• 28,140 points
1,046 views
0 votes
1 answer

What is the use of @Rule annotation in JUnit?

Hello Sarfaraz, JUnit provides special kind of handling ...READ MORE

answered Jun 19, 2019 in Selenium by anonymous
• 28,140 points
1,620 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP