Introduction to page objects | Ranorex Webtestit User Guide
WebtestitUser GuideIntroduction

Page objects

Testing your website or app requires careful planning and preparation. You would want to consider changing requirements and growing complexities as the product matures and grows. Key to the successful implementation of automated tests is planning your test setup before the test execution. Automation frameworks offer you a set of constructs that help you to structure your tests in different workflows. You use test suites and test cases to arrange the necessary bits into logical groups. Learn more about test structuring here. But what about the elements? Imagine having multiple test files that use the same selector to automate a specific button of your website or application. Defining the selector in each test file means that, in the event that it changes, you’d have to change it in each test file as well. Page objects help you to organize your selectors centrally and introduce a layer of abstraction towards your test files. Utilizing Page Objects, you define selectors once per element and reuse them as you go. If the locator breaks and you have to change the selector, you only have to change it in one central location.
Note icon


When planning to test your website or app, consider separating element and test operations into different domains.
But behind the concept of Page Objects is much more than just a collection of elements. There’s the Page Object Pattern, which helps you to manage actions instead of elements. Ranorex Webtestit comes with a workflow centered around Page Objects, which you’ll learn about in this chapter.