Skip to main content

Page Objects for Python

Project description

Page Objects are a testing pattern for websites. Page Objects model a page on your site and 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.

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

Documentation

https://page-objects.readthedocs.org

Quick Example

>>> from page_objects import PageObject, page_element
>>> from selenium import webdriver
>>>
>>> class LoginPage(PageObject):
        username = page_element(id_='username')
        password = page_element(name='password')
        login = page_element(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.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)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

page-objects-1.0.1.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

page_objects-1.0.1-py2-none-any.whl (5.2 kB view details)

Uploaded Python 2

File details

Details for the file page-objects-1.0.1.tar.gz.

File metadata

  • Download URL: page-objects-1.0.1.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for page-objects-1.0.1.tar.gz
Algorithm Hash digest
SHA256 e5c40b712a8defc29bd3e436dd3c28c2e1c512a73e6635c733db029ab244b04c
MD5 0c5aee3aee31202cd7b4c4554602eec7
BLAKE2b-256 e1255ea0a39cc59b390e0f3005c5869c14b7cd2e1e07bb7c934038dc9a56ee89

See more details on using hashes here.

File details

Details for the file page_objects-1.0.1-py2-none-any.whl.

File metadata

File hashes

Hashes for page_objects-1.0.1-py2-none-any.whl
Algorithm Hash digest
SHA256 4de12bea3153f391eb7a756998c68064f8affa535c4ceb70c67be848913856b0
MD5 6f85024ab81b7db23fb7435d08eb3522
BLAKE2b-256 c9f74ffc36320a9626bb6154f63fc210252399a11b714d79ae92ba32ced3f34c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page