🖋️
QualityMate
  • QualityMate
  • Getting Started
    • Introduction
    • Why QualityMate
    • Architecture
    • Supported Web Browsers
    • Glossary
  • Components
    • UI Player
      • Basic Concepts
      • UiPlayer
      • MSTest Integration
      • Samples
        • QualityMate Sample Desktop
        • QualityMate Sample Web
        • QualityMate MSTest Integration Sample Desktop
        • QualityMate MSTest Integration Sample Web
        • QualityMate Integration with Test Frameworks
        • Web Authentication Sample
      • QualityMate Project Template
    • UI Recorder
      • Basic Concepts
      • Setting Up the Recorder
      • Validating an Element
      • Generating QualityMate Solution
  • Tools
    • File Comparators
    • Image Processor
    • Project Merger
    • Test Case Generator
      • Filters
      • Rename Recorded Controls
  • Basic Concepts
    • Page Object
      • Work Guide
    • Controls
      • Control Types
        • Generic Types
        • Desktop types
        • Web Types
        • WebMap types
          • Kendo PowerBuilder
          • Kendo WinForms
          • Kendo Silverlight
      • Interactions
        • SendKeys
        • Validate
    • Selectors
      • Selectors in Code
      • Default Selector
      • Shared Selector
      • Selectors Category
        • CSS Selector
        • XPath Selector
        • Image Selector
        • Frame Selector
      • Identifying Selector
        • Identify for Windows Desktop
        • Identify for Web
  • How to Guides
    • Setting Up the Configuration
      • Parameters
      • Context
      • Loading External Data
    • Awaiting for the Application
      • Busy Loaders
      • Retries
    • Defining Controls
      • Extending Controls
      • Control Slice
      • Control Collection
    • Logging on Tests
      • QualityMate Reports
      • Logging
  • Help
    • Best Practices
      • Environment
      • Tests
      • Page Objects
      • Validations
      • Interactions
      • Image Comparisons
    • Known Issues
    • Continuous Integration
      • Agents Session
    • Upgrading QualityMate
      • From version 7 to version 8
      • Previous Versions
      • How to switch from TestFeature to UiTest
    • VS Test
      • Command Line
      • Generate Reports
  • API
    • Control Interfaces
      • IButton
      • ICheckBox
      • IComboBox
      • IControl
      • IControlSlice
      • IDateTimePicker
      • IElement
      • IGrid
      • IGroupBox
      • ILabel
      • IListBox
      • IMenu
      • INumericUpDown
      • IPageObject
      • IProgressBar
      • IRadioButton
      • IRadioButtonGroup
      • ISplitButton
      • IStatusStrip
      • ITab
      • ITextBox
      • IToggleButton
      • IToolBar
      • ITreeView
    • Behavior
      • ICheckableControl
      • IList
      • ITextControl
    • Enums
      • ClickType
      • KeyModifiers
      • MouseButton
  • Changelog
    • Changelog
      • Version 8
      • Version 7
      • Version 6
      • Version 5
      • Version 4
      • Version 3
Powered by GitBook
On this page
  • Creating a Page Object
  • Simple PageObject
  • Inner PageObject
  • Usage in Code

Was this helpful?

  1. Basic Concepts

Page Object

PreviousRename Recorded ControlsNextWork Guide

Last updated 2 years ago

Was this helpful?

A Page Object is a plain class that represents a page or window on a web or desktop application. This concept comes from the PageObject design pattern for enhancing test maintenance and reducing code duplication.

Creating a Page Object

When creating a Page Object you will need the following:

  • Page Object classes must inherit from PageObject class which is under the Mobilize.QualityMate.Automation.Entities namespace.

  • The control property type has to be an interface from the Mobilize.QualityMate.ControlInterfaces namespace(link).

  • The control properties must be declared public and with both get and set accessors.

Simple PageObject

The following is an example of a PageObject declaration

using Mobilize.QualityMate.Automation.Entities;
using Mobilize.QualityMate.ControlInterfaces;

public class MyPageObject : PageObject
{
    public IButton myButton { get; set; }

    // Add other PageObject controls here
}

Inner PageObject

Sometimes, a PageObject has a lot of members to maintain, so you can create an Inner PageObject to group members into a smaller representation. Here is a sample of an Inner PageObject.

using Mobilize.QualityMate.Automation.Entities;
using Mobilize.QualityMate.ControlInterfaces;

public class MyPageObject : PageObject // The Window
{
    public MyInnerPageObject myInnerPageObject { get; set; }

    // Add other PageObject controls here
}
​
public class MyInnerPageObject : PageObject // The Window's group controls
{
    public ITextBox myTextBox { get; set; }
    // Add other PageObject controls here
}

Usage in Code

Once your Page Object is created you will need the UiExecutionController to initialize the PageObject and members with the method GetPageObject(). You can achieve this using the following code:

public void MyMethod(UiExecutionController controller)
{
    MyPageObject mainPage = controller.GetPageObject<MyPageObject>();

    // Add interactions to PageObject or controls
}

Check the article to know our recommendations on Page Objects.

Best Practices
Representation of a PageObject as a Window
Representation of Inner PageObjects on a Window