Why use Page Factory?

后端 未结 5 692
北恋
北恋 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:53

    • Why do I want to instantiate all the elements instead of doing it on the fly?

      The PageFactory can be used to initialize elements of a Page class without having to use FindElement or FindElements. When you are using the webelement(s) more then once your code gets better readable.

    • What are the advantages of Page Factory that I'm missing?

      You also can use some attributes with the Page Factory. The most obvious is the FindsBy attribute but you can also use the CacheLookup attribute to cache the element once it is looked up once.

提交回复
热议问题