From the course: Selenium Essential Training

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Use page objects

Use page objects - Selenium Tutorial

From the course: Selenium Essential Training

Start my 1-month free trial

Use page objects

- [Instructor] I'd like to introduce the concept of page objects. Page objects are very useful in Selenium tests as they allow functionality to be separated into different classes based on pages or area of functionality in the application. The benefits to this are that it can be easy to organize test code and helps to keep the test class, itself, even more clean and readable. In the last video, I did some refactoring to take all the major steps of the test and extract them into methods. Now, I'm going to extend that example and move these methods outside of the test class and into specific page object classes to demonstrate the page object pattern. I'll start by creating a new directory under the root project of start and I'll right-click and select new directory. And I will call this new directory pages. Then, I'll right-click on this directory and create a new Java Class called FormPage. In this page object class, I'll want to have the method to submit a form. So I'll hop back over…

Contents