I am a new test engineer and have been reading about Page Object Model and implementing them and keep coming across Page Factory. I understand that Page Factory is a POM tha
Why do I want to instantiate all the elements instead of doing it on the fly?
In general, when we initiate any page class through PageFactory
, it enables us to load all the desired (defined) WebElements
at the same time with which we intend to interact in the coarse of Test Execution.
What are the advantages of Page Factory that I'm missing?
The advantages of using Page Factory
is numerous. Some of them are as follows:
Page Factory
makes your framework more structured, robust and maintainable.DOM Tree
of any individual/multiple page can be accommodated with quite ease.Page Factory
, the different calls between @Test
class, BrowserFactory
, Page Objects
and Assertions
becomes more cleaner and efficient.Page Factory
like FindBy
, FindBys
, and CacheLookup
speeds up our Test Execution
by a huge extent.