Skip to main content

Page Objects are a testing pattern for websites. Page Objects model a page on your site to provide accessors and methods for interacting with this page, both to reduce boilerplate and provide a single place for element locators.

This project is an implementation of this pattern for Python using Selenium webdriver. It is agnostic to test harnesses and designed to help you build up libraries of code to test your sites.

https://travis-ci.org/eeaston/page-objects.svg?branch=master

Documentation

https://page-objects.readthedocs.org

Quick Example

>>> from page_objects import PageObject, PageElement
>>> from selenium import webdriver
>>>
>>> class LoginPage(PageObject):
        username = PageElement(id_='username')
        password = PageElement(name='password')
        login = PageElement(css='input[type="submit"]')
>>>
>>> driver = webdriver.PhantomJS()
>>> driver.root_uri = "http://example.com"
>>> page = LoginPage(driver)
>>> page.get("/login")
>>> page.username = 'secret'
>>> page.password = 'squirrel'
>>> assert page.username.text == 'secret'
>>> page.login.click()

Installation

$ pip install page_objects

Project History

This was originally part of the pkglib project at http://github.com/ahlmss/pkglib, it has been forked to retain history.

Release History

1.1.0 (2014-10-15)

  • Added feature: PageElements can now be contructed with context

  • Deprecated page_element and mutli_page_element factory methods

1.0.1 (2014-09-30)

  • Added PageObject.get(uri) method, based off of the page’s root_uri attribute.

1.0.0 (2014-09-29)

Metadata

Release files for page-objects 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for page-objects 1.1.0
File Size Uploaded
page-objects-1.1.0.tar.gz 4.5 kB Details

Release files / page-objects-1.1.0.tar.gz

Download URL page-objects-1.1.0.tar.gz
Size 4.5 kB
Tags Source
SHA-256 checksum
How to use checksums
885912f1d7a47354107a4132f8dfc350f450621ba372e221762a33288880a134
BLAKE2b-256 checksum
How to use checksums
6a4c93708fae588a03b2f8a9672d15f32322e5363b9cef0c256e88525ac2f68d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

1.1.0 This release

1 release file

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page