Meaghan Lewis explains what page objects are and how to use them to organize a test suite so that all functionality is tied to a specific page within the application.
- [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 to the form class…and what I'll do is I'll copy the submit form method…
- Using browser drivers and WebDriver
- Inspecting elements
- Selecting a locator
- Combining multiple CSS attributes
- Using common components
- Implicit and explicit waits
- Automating workflows
- Testing behaviors
- Using page objects
- Connecting to GitHub
- Running on the grid
- Using cloud-based testing tools
Skill Level Intermediate
1. Review Fundamentals
2. Succeeding with WebDriver
3. Using Advanced Locators
4. Interacting with Components
5. Synchronization Issues
6. Putting It All Together
7. Project Integration
Next steps1m 32s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.