Why use Page Factory?

后端 未结 5 677
北恋
北恋 2020-12-30 08:14

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

5条回答
  •  时光取名叫无心
    2020-12-30 08:47

    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:

    1. Page Factory makes your framework more structured, robust and maintainable.
    2. Changes in the DOM Tree of any individual/multiple page can be accommodated with quite ease.
    3. Through Page Factory, the different calls between @Test class, BrowserFactory, Page Objects and Assertions becomes more cleaner and efficient.
    4. The additional attributes of Page Factory like FindBy, FindBys, and CacheLookup speeds up our Test Execution by a huge extent.

提交回复
热议问题