We have seen Page Object Model In Selenium. In this post, I will explain a way ( Mostly what I have seen in many selenium frameworks) to design a proper page object model.
It is also asked in interview that if you have implemented encapsulation and abstraction in selenium framework. This post might help you.
We can achieve encapsulation and abstraction in page object model using this way. We will declare page objects as private and provide a getter method to access page object.
We will see an example below:
Page Object Class:
There might be many other ways of implementing or designing a better page object model. I shared what I have seen and used. If you have any other approach, please let others know as well.
If you have any doubt, feel free to comment below.
If you like my posts, please like, comment, share and subscribe.