From the course: Test Automation with Selenium WebDriver for Java
Unlock this course with a free trial
Join today to access over 24,700 courses taught by industry experts.
Page Object Model design pattern
From the course: Test Automation with Selenium WebDriver for Java
Page Object Model design pattern
- [Instructor] For web applications, you need framework classes that interact with the pages of the system. The most popular design pattern for creating these classes is the page object model. This model recommends creating a separate class for each page of your application. Within a given class resides the elements of that page as well as methods for interacting with those elements. Let's take this login page for example, using the page object model, you'd create a login page class, that includes web elements and methods to enter the username, enter the password, and click the login button. Your test can then call these methods to perform actions on the page, keeping the test code focused on validating behavior rather than interacting with the UI elements directly. The page object model design pattern promotes reusability, and reduces code duplication. It also increases the maintainability of the code base because if a webpage is structured changes, you only need to update the…
Contents
-
-
-
-
-
-
-
-
-
-
(Locked)
Framework and tests1m 12s
-
(Locked)
Page Object Model design pattern1m 16s
-
(Locked)
Initializing elements3m 1s
-
(Locked)
Implementing interaction methods5m 3s
-
(Locked)
Using Page Objects in tests7m 45s
-
(Locked)
Code challenge: Implement Page Object Model47s
-
(Locked)
Solution: Implement Page Object Model4m 5s
-
(Locked)
-