Ensar Turkoglu
Ensar Turkoglu

Reputation: 124

Is Page Object Design Pattern with Selenium creating classes of pages and invoking their constructors by the objects of them?

I've already created a Java Maven test project with Selenium. And I need to convert it into the Page Object Design Pattern. As I could understand from the official documents, we are creating the classes of the pages and then we invoke them by the objects we created in the main class ?

Is it true what i've understood? Thanks in advance.

Upvotes: 2

Views: 100

Answers (1)

Saifur
Saifur

Reputation: 16201

You have understood it correctly. The idea is to have the responsibility separated. Creating a PageObjet for each pages gives you the ability to keep the responsibility separated and if anything changes on that page changing the mapping in one place would be sufficient. You tests should only follow the steps an user will do and all the element and mapping would be held in PageObject.

Additionally, a base page would help to have the common functions you would use throughout the test.

I see this as taking the advantage of OOP. A good bit of information about the implementation can be found here

Upvotes: 1

Related Questions