From the course: Selenium Essential Training
Unlock the full course today
Join today to access over 24,000 courses taught by industry experts.
Use page objects - Selenium Tutorial
From the course: Selenium Essential Training
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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.