How to use Page Objects | Functionize

To use Page Objects in Functionize, you can either record them through Architect or create them manually from the Test Detail page.

How to use Page Objects | Functionize

Recording Page Objects through Architect

To record a Page Object through Architect, follow these steps:

  1. Open Architect and create a new test case.
  2. Click the “Record” button.
  3. Navigate to the page that you want to create a Page Object for.
  4. Perform the actions that you want to record.
  5. Click the “Stop Recording” button.
  6. Enter a name for the Page Object and click “Save”.

Creating Page Objects manually from the Test Detail page

To create a Page Object manually from the Test Detail page, follow these steps:

  1. Open the Test Detail page for the test case that you want to create a Page Object for.
  2. Click the “Add Page Object” button.
  3. Enter a name for the Page Object and click “Create”.
  4. On the Page Object page, click the “Add Action” button.
  5. Select the action that you want to add to the Page Object and click “Add”.
  6. Repeat steps 4 and 5 until you have added all of the actions that you want to include in the Page Object.
  7. Click the “Save” button.

Once you have created a Page Object, you can use it in your test cases by simply dragging and dropping it onto the test case canvas. You can also use Page Objects in loops and conditional statements.

Benefits of using Page Objects

There are several benefits to using Page Objects, including:

  • Reusability: Page Objects can be reused in multiple test cases, which can save you time and effort.
  • Maintainability: Page Objects are easier to maintain than test cases, as they are more modular and reusable.
  • Readability: Page Objects make test cases more readable and easier to understand.

Overall, Page Objects are a powerful tool that can help you to write more efficient, reusable, and maintainable test cases.

To use Page Objects in Functionize, you can either record them through Architect or create them manually from the Test Detail page.

Recording Page Objects through Architect

To record a Page Object through Architect, follow these steps:

  1. Open Architect and create a new test case.
  2. Click the “Record” button.
  3. Navigate to the page that you want to create a Page Object for.
  4. Perform the actions that you want to record.
  5. Click the “Stop Recording” button.
  6. Enter a name for the Page Object and click “Save”.

Creating Page Objects manually from the Test Detail page

To create a Page Object manually from the Test Detail page, follow these steps:

  1. Open the Test Detail page for the test case that you want to create a Page Object for.
  2. Click the “Add Page Object” button.
  3. Enter a name for the Page Object and click “Create”.
  4. On the Page Object page, click the “Add Action” button.
  5. Select the action that you want to add to the Page Object and click “Add”.
  6. Repeat steps 4 and 5 until you have added all of the actions that you want to include in the Page Object.
  7. Click the “Save” button.

Using Page Objects in your test cases

Once you have created a Page Object, you can use it in your test cases by simply dragging and dropping it onto the test case canvas. You can also use Page Objects in loops and conditional statements.

For example, the following test case uses a Page Object to log in to a website:

# Create a new test case.
test_case = fze.testcase("Login to Website")

# Create a Page Object for the login page.
login_page = fze.page_object("LoginPage")

# Open the login page.
login_page.open()

# Enter the username and password.
login_page.enter_username("username")
login_page.enter_password("password")

# Click the login button.
login_page.click_login_button()

# Verify that the user is logged in.
fze.action("VerifyUserLoggedIn").execute()

Benefits of using Page Objects

There are several benefits to using Page Objects, including:

  • Reusability: Page Objects can be reused in multiple test cases, which can save you time and effort.
  • Maintainability: Page Objects are easier to maintain than test cases, as they are more modular and reusable.
  • Readability: Page Objects make test cases more readable and easier to understand.
  • Encapsulation: Page Objects encapsulate the logic for interacting with a particular page in a web application. This makes your test cases more modular and reusable.
  • Reduced code duplication: Page Objects can help you to reduce code duplication in your test cases. This makes your test cases easier to maintain and update.

Overall, Page Objects are a powerful tool that can help you to write more efficient, reusable, maintainable, and readable test cases.

Leave a Comment