Skip to content
Test framework

Page Objects

Turn recorded steps into reusable page models with named elements and methods.

A Page Object gives names to the elements of a page and groups common actions into methods you can reuse across tests (e.g. login(email, password)), so a change in the page is fixed in one place. Find it in the dock under Framework → Pages.

Add elements

  • From the Action History (main way): click the box icon on any step card — its element is added to the current Page Object; click again to remove it. The first element also names the Page Object after its page.
  • Record Page: click Record Page and click elements directly in the browser, for elements that are not in your recording. Click Stop when done.

The Elements column

For each element:

  • An editable name (used in the code).
  • A page chip showing which page it came from. The chip turns red when the element comes from a different page than most of the others.
  • single / list · N — for elements that belong to a repeating list, switch between the single element and the whole set.
  • × removes it; the locator used is shown below. Hovering highlights the element in the browser.

Methods

  • Add method (needs at least one element): give it a name and optional parameters (comma-separated). Then Add a step: choose a verb (click, fill, selectOption, check, press), an element, and a value (or a key for press). Write {param} as the value to use a parameter — the { } button next to the field inserts it. Reorder steps with Move up / Move down.
  • To method (faster): select steps in the Action History and click To method. A method (method1, method2, …) is created with those steps, the elements are added automatically, and every typed value becomes a parameter named after its field (e.g. two fills on Email and Password → method1(email, password)). Rename it as you like. Only interactions become method steps; navigations and assertions are skipped.

Save, open, delete

  • Type the name in the PageName field and click Save Page Object. The class is saved in the project’s pages folder. Copy copies the generated class.
  • Open saved… reopens a saved Page Object. Saving it again overwrites it. Saving a new Page Object with a name already in use adds a number (e.g. LoginPage2) and tells you.
  • New starts an empty Page Object (the current one is saved first).
  • The trash icon deletes the saved Page Object from disk, after confirmation.
Page Objects — Actify Studio Docs