The Page Object Model is a design pattern to create an object model for Web UI elements, you can map every page to one-page object model class, the elements which are on the page are going to be properties of the class the main advantage of this is you can re-use this object model, the page object model makes your code reusable and avoids code duplication
Let me take simple scenario, the home page of my blog has search functionality and the category page also has search functionality, I want to test search functionality on home page and on category page
here, what I am going to do is creating an object model for search functionalities and re-use it on different test cases, check the below code, I have created page object model only once and that is for search elements and re-using it in multiple test cases
Another advantage is we don’t need to touch test cases if something changes in page object models, there is a clear separation between models and test cases, check the below screenshot, there are different package’s for models and test cases
A technology enthusiast and a professional blogger from India. Through out my IT career, I have had the pleasure of working on various new technologies and built products like www.ziprides.com and some other products. Unfortunately, my attempts have not given me the desired results and as a result, I have finally decided to build a professional blog where I would like to share all my learnings and hoping to learn from other enthusiasts around the world.