From the course: Test Automation with Selenium WebDriver for Java

Unlock this course with a free trial

Join today to access over 24,800 courses taught by industry experts.

Solution: Implement Page Object Model

Solution: Implement Page Object Model

(exciting music) - [Instructor] There are lots of design considerations that are made when implementing the page object model, so don't worry if your solution isn't exactly like mine. I'll share the rationale behind the decisions I made, and you can determine which techniques you prefer. I start with writing my test code first. This helps me determine just how much framework code I need to support the test code. Some pages have lots of elements and functionality, and I don't want to build framework code if it's not necessary for the tests. I created a class called DynamicallyModifiedTests that extends base tests. Base tests, sets up the web driver and closes the browser when done. I created an object to represent the page and a method to launch the page, and initialize the page object before each test runs. The first test is to verify that when the button hasn't been clicked, the element is present in the dom. I want to know if the element is present. This is something the page should…

Contents