Implementing the Page Object model in Python

Implementing the Page Object model in Python is similar to what we have done previously in Java and C#. The Selenium WebDriver Python bindings provide support for objects of the Page Object model.

In this recipe, we will implement the Page Object model using Python bindings.

Getting ready

Before implementing the Page Object model for Python bindings, we must do the following:

  • Identify pages and the elements from the application that will be required in the tests
  • Define locators that will be needed to identify the elements uniquely

How to do it...

To implement the Page Object model in Python, follow these steps:

  1. Define a class for the Page Object model by creating a Python script with the name of the page. In ...

Get Selenium Testing Tools Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.