In interview it is frequently asked question that “How To Establish Relationship Between Pages In Page Object Model In Selenium WebDriver”. It is very simple question but generally interviewee confuses. I will explain in a simple way in this post.
What is establishing relations between pages?
Suppose you have two pages, Page A and Page B. When you click on some web element on Page A, it navigates to Page B. So you should create method in such a way that after clicking on web element, it gives you control on Page B. User should not create an object of Page B to access members of Page B.
Take example of DemoQA . In home page it has a link “Registration”. When user clicks on it, user navigates to Registration page. So, you should create a method say “clickOnRegistrationLink” and set a return type as object of Registration page. It is called establishing relationship between pages.
If you have any doubt, feel free to comment below.
If you like my posts, please like, comment, share and subscribe.
Author: Amod Mahajan
My name is Amod Mahajan and I am an IT employee with 4+ years of experience in Software testing and staying in Bengaluru. My area of interest is Automation testing. I started from basics and went throw so many selenium tutorials. Thanks to Mukesh Otwani as his tutorials are easy and cover basics to advance. I have habit of exploring concepts by deep diving. I used to make notes. I thought of sharing my knowledge through posts and now I am here. #KeepLearning #ShareLearning