The following are the POM interview questions and answers:
If you want more questions with explanation watch below Video:
1. What is POM ? Advantages of POM?
Page Object Model (POM) is a design principle to manage the test cases and page objects separately.Framework types like data-driven, behavior-driven, keyword-driven, etc. can be designed with the page object model.
The main advantage of Page Object Model is that if the UI changes for any page, it don’t require us to change any tests, we just need to change only the code within the page objects.
improves code readability - Allows us to separate operations and flows in the UI from Verification
Re-usability of code - a locator or function can be reused in the tests.Eliminate
redundancy – no duplicity of functions or locators.
2. What is Page Factory?
Page Factory is enhancement of POM. Page factory provide the facility to locate and initialize Web Elements of an page without using findElement( ) or findElements( ) method of selenium
Page factory provides annotations like @FindBy, @FindAll, which locate the web element and return the WebElement instance for the same
These annotations use the attributes for specific locator types like id, name, class name, CSS, link text, partial link text, class-name, and XPath
3. How page classes will interact with Web Elements in POM?
The Page object is an object-oriented class which acts as an interface for the page of your Application under test. Page class contains web elements and methods to interact with web elements. While automating the test cases, we create the object of these Page Classes and interact with web elements by calling the methods of these classes
4. What are the OOPS Concepts applied in POM?
Both POM and page Factory Design patterns inspired through abstraction.
WebDriver driver = new FirefoxDriver();
5. What are the Design Pattern used in the Project?
Most frequently used design patterns is POM (Page Object Model). Enhanced POM, also known as Page Factory can be used which helps you in resolving stale element exception, also provides cache management.Both POM and Page Factory design patterns are inspired through Abstraction
Strategy Design pattern
6. What are the Challenges faced while Working with Selenium Automation?
Generally an automation engineer face is maintaining the code.
If your application is frequently changing html elements of the page and some new components are being added and so on, this may affect your code especially locators.
To get rid of these situations we have certain design patterns like POM (Page Object Model), Page Factory.
One more challenge is while working with Selenium is Synchronization.
7. How to Explain Project in Interview For Experienced?