Skip to main content

Pretty Page Object Generator

Project description

Pretty Page Object Generator

A simple tool to make your page objects pretty and save some time for standard methods implementation.

class BasePage(PrettyPageObject):
    def __init__(self, driver):
        super(BasePage, self).__init__(driver)
        self.button('ok', By.ID, 'ok')
        self.text_field('login', By.XPATH, '//login')
        self.label('welcome_message', locator='welcome_message')
        self.elements('custom_parameters', locator='locator')
        self.element('parent', locator='xxx')
        self.button('button_that_difficult_to_find', By.XPATH, '/a', parent_getter=self.parent_element)

def test_page(driver):
    page = BasePage(driver)
    page.login = 'SuperUser'
    page.ok()
    wait_for_element(page.welcome_message_element())
    assert page.welcome_message == "Welcom SuperUser"

Usage

Just inherit your Base Page class from PrettyPageObject and that's all!

Features

Prettypo generates several methods for the requested element depending on the type of the element

  • self.button('name', by, locator, parent_getter) will generate next methods:
    • name() - to call click()
    • name_element() - to get full access to WebElement object
  • self.text_field('name', by, locator, parent_getter)
    • name property to get element's .text()
    • name=string - setter is reassigned to .send_keys(string)
    • name_element() - to get full access to WebElement object
  • self.elements('name', by, locator, parent_getter)
    • name_elements() - get list of WebElement objects
  • self.label('name', by, locator, parent_getter)
    • name property to get element's .text()
    • name_element() - to get full access to WebElement object

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

prettypo-0.0.5.tar.gz (2.5 kB view details)

Uploaded Source

Built Distribution

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

prettypo-0.0.5-py3-none-any.whl (15.2 kB view details)

Uploaded Python 3

File details

Details for the file prettypo-0.0.5.tar.gz.

File metadata

  • Download URL: prettypo-0.0.5.tar.gz
  • Upload date:
  • Size: 2.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.7

File hashes

Hashes for prettypo-0.0.5.tar.gz
Algorithm Hash digest
SHA256 cd44471cb6adf3705ecfc7d344a28f396d56d88aa18c6ff0cd36785408b007e9
MD5 57edf5f9c9a997cbe830ecb766a7ea63
BLAKE2b-256 4b01cedd25f889fe34b78e214fe3754485e4a7537dd7bb0b46a11d08dec3f54c

See more details on using hashes here.

File details

Details for the file prettypo-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: prettypo-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 15.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.7

File hashes

Hashes for prettypo-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 e167b2f11f60be0938e5e6d9365af066bf1397ffc146d650dcd77d3d1d151529
MD5 2f4e61f6c085d77b1bf981e13dcab197
BLAKE2b-256 1aaf2405ec4623699abf9a8a208587a3ad29cf32a6f04eb34666125d0d3a241e

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