From the course: Advanced Selenium: Support Classes

Unlock the full course today

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

What is a page object?

What is a page object? - Selenium Tutorial

From the course: Advanced Selenium: Support Classes

Start my 1-month free trial

What is a page object?

- [Narrator] Page objects are one of the simplest ways of writing tests that are readable and maintainable. This test without page objects is robust. It has explicit weeds, but it is not readable. We can't see at a glance what it's trying to do. On line 44 it waits until an element of select menu is visible. Then on line 48, wraps it in a select so we assume it is a select element. Then on line 49 it selects an item with the text option two. Then waits for something with an id of message to be visible on line 52. And finally on line 54, a search that the message text is what we are expecting. I would probably have to open this system we are automating to really understand this test code. We also have the disadvantage that the waits would be repeated across multiple tests, and we would have a lot of duplicated code. Which means we have more code to maintain when the application changes, and it also means that we would…

Contents