rRahkola
rRahkola

Reputation: 31

Which WebElements are filled by PageFactory.initElements?

I am trying to use the PageObject design pattern with my Selenium testing, and I have the following set of Page classes:

When I create a new UserLandingPage using the method:

 UserLandingPage userLanding = PageFactory.initElements(driver, UserLandingPage.class);

which WebElements get populated? Just the ones which are visible to the UserLandingPage class, or does PageFactory somehow look at all the base classes and populate those WebElements as well?

Upvotes: 3

Views: 1747

Answers (1)

jdumonti
jdumonti

Reputation: 26

All the visible fields that you have annotated will be initialized to the associated web elements.

Upvotes: 1

Related Questions