Page Object Model Automation framework - Explaining with a scenario

As mentioned in the starting post. This section explaining Page object model with a scenario. Let's say you've got a Login and Registration page to automate. I've created an application with the help of the Python Flask framework and we can use it for explaining the scenario. The application has two pages, Login and Registration as shown below

Login page

Registration page


In the Page Object Model (POM), we need to create a class file for each page such as Login and Registration. The class file should contain all the UI elements and methods of the corresponding page. It is a page object and using this page object the test can communicate to the Application to be tested (AUT).  Please have a look at the below diagram 

Base class - The base class contains common test methods like Wait_for_Element, Click_Element and Common methods, etc 

Login and Registration class - Login and Registration classes are inherited from the Base class. It should contain the UI elements and methods required. Each class file should be independent and should not share any common code. Let's have an example with the Login class, it should contain the UI properties of the Username, Password, and Submit button and its methods are login()invalid_username()invalid_password() etc.

Test class files - Login and Registration test class files need to access their corresponding page object class and prepare the test. The tests are should be independent and it enhances moduluariazation 


أحدث أقدم