Page Object Model (POM) & Page Factory: Selenium WebDriver Tutorial (medium)

AwedExuberance avatar
AwedExuberance
·
·
Download

Start Quiz

Study Flashcards

30 Questions

Which concept in Selenium WebDriver is used for initialization of Page objects or to instantiate the Page object itself?

Page Factory

What is the purpose of @FindBy annotation in Page Factory in Selenium?

To find WebElements

Which attribute(s) can @FindBy accept?

tagName, partialLinkText, name, linkText, id, css, className, xpath

What does the initElements() method do in Page Factory?

Initializes Page class elements

What is the purpose of the Guru99HomePage class in Page Factory?

To initialize web elements

What is the purpose of the test_Home_Page_Appear_Correct() method in the Test99GuruLoginWithPageFactory class?

To get the home page dashboard username

What is the purpose of the clickLogin() method in the Guru99Login class?

To click on the login button

Which design pattern is popularly used in test automation to create an Object Repository for web UI elements?

Page Object Model

What is the advantage of using Page Object Model (POM) in test automation?

It reduces code duplication and improves test maintenance.

What should a Page Class in Page Object Model (POM) contain?

WebElements of the web page and Page methods

How should the methods in a Page Class be named in Page Object Model (POM)?

Descriptive names based on the task they perform

What does POM stand for in Page Object Model (POM)?

Page Object Model

What is the purpose of the Page Factory in Selenium?

To create Page Objects in Page Object Model (POM)

What is the main task in UI Automation using Selenium WebDriver?

Finding elements and performing operations on them

Which approach helps make code more readable, maintainable, and reusable in Selenium?

Page Object Model

What is the chief problem with script maintenance when multiple scripts are using the same page element?

Changes in the element require changes in all scripts

What is the benefit of separating operations and flows in the UI from verification in the Page Object Model?

Makes the code cleaner and easy to understand

What is the purpose of the object repository in the Page Object Model?

To store web elements

What is the purpose of the Guru99 Login page POM class in Selenium?

To set user name and password

What is the purpose of the Guru99 Home Page POM class in Selenium?

To get the user name from the home page

What is the purpose of the Test99GuruLogin test case in Selenium?

To login to Guru99

Which design pattern is used in Selenium WebDriver to create an Object Repository?

Page Object Model

What is the purpose of the Page Factory in Selenium?

To create an Object Repository

What is the advantage of using AjaxElementLocatorFactory in Selenium?

It provides a timeout for web elements

What exception is thrown when a web element is not found within the given time interval?

NoSuchElementException

Which concept in Selenium assigns a timeout for web elements in the page class?

AjaxElementLocatorFactory

What is the main advantage of using the Page Object Model (POM) in Selenium?

Reusable and maintainable testing code

What is the purpose of the Page Object Model (POM) in Selenium WebDriver?

To create an Object Repository

What is the key advantage of using the AjaxElementLocatorFactory in Selenium?

Lazy loading of web elements

What design pattern is used in Selenium WebDriver to create an optimized Object Repository?

Page Object Model

Study Notes

Selenium WebDriver Concepts

  • The concept of Page Factory is used for initialization of Page objects or to instantiate the Page object itself.
  • The @FindBy annotation in Page Factory is used to locate web elements on a page.
  • The @FindBy annotation can accept various attributes such as id, name, className, css, xpath, and linkText.
  • The initElements() method in Page Factory is used to initialize the Page object itself.
  • The Guru99HomePage class in Page Factory is a Page object that represents the Guru99 home page.
  • The test_Home_Page_Appear_Correct() method in the Test99GuruLoginWithPageFactory class is a test case that verifies the correctness of the Guru99 home page.
  • The clickLogin() method in the Guru99Login class is used to click the login button on the Guru99 login page.
  • The Page Object Model (POM) design pattern is popularly used in test automation to create an Object Repository for web UI elements.
  • The advantage of using Page Object Model (POM) is that it makes the test code more readable, maintainable, and reusable.

Page Object Model (POM) Concepts

  • A Page Class in Page Object Model (POM) should contain operations and flows related to a specific page.
  • Methods in a Page Class should be named in a way that describes the action performed on the page.
  • POM stands for Page Object Model.
  • The purpose of the Page Factory in Selenium is to initialize Page objects.
  • The main task in UI Automation using Selenium WebDriver is to automate interactions with web pages.
  • The Page Object Model (POM) approach helps make code more readable, maintainable, and reusable.

Object Repository and Page Factory

  • The Page Factory in Selenium is used to create an optimized Object Repository.
  • The advantage of using AjaxElementLocatorFactory is that it waits for the elements to be available before throwing a NoSuchElementException.
  • The NoSuchElementException exception is thrown when a web element is not found within the given time interval.
  • The concept of Page Object Model (POM) assigns a timeout for web elements in the page class.

Benefits of Page Object Model (POM)

  • The main advantage of using Page Object Model (POM) is that it separates operations and flows in the UI from verification.
  • The purpose of the object repository in the Page Object Model is to store web elements.
  • The purpose of the Guru99 Login page POM class is to represent the Guru99 login page.
  • The purpose of the Guru99 Home Page POM class is to represent the Guru99 home page.
  • The purpose of the Test99GuruLogin test case is to verify the Guru99 login functionality.

Test Your Knowledge in Selenium WebDriver with this Quiz!

Make Your Own Quizzes and Flashcards

Convert your notes into interactive study material.

Get started for free
Use Quizgecko on...
Browser
Browser