Skip to main content

Python library provides page factory approach to implement page object model in selenium

Project description

  • A Page Factory is one way of implementing a Page Object Model. In order to support the Page Object pattern.
  • As in Java we are using @findBy, here we are declaring all web element in dictionary. Dictionary keys become WebElement or class member variable with having all extended WebElement methods.

Main Features

  • Initialise all the webElements declared in Point at a time.
  • All WebElements methods are re-define to add extra features. eg- click method extended to have explicit wait for element to be clickable.
  • Cent percent unittest coverage.

Installation

  pip install selenium-page-factory

Pre-Requisite

Every Page in Page Object Model should have WebDriver object as class member as shown below

class PageClass(PageFactory):

    def __init__(self,driver):
        self.driver = driver    # Required
        self.timeout = 15       #(Optional - Customise your explicit wait for every webElement)
        self.highlight = True   #(Optional - To highlight every webElement in PageClass)

Custom WebElement Methods

  • set_text
  • get_text
  • clear_text
  • click_button
  • double_click
  • get_list_item_count
  • select_element_by_text
  • select_element_by_index
  • select_element_by_value
  • get_all_list_item
  • get_list_selected_item
  • hover
  • is_Checked
  • is_Enabled
  • getAttribute
  • element_to_be_clickable
  • invisibility_of_element_located
  • visibility_of_element_located
  • double_click

Note: Every WebElement will be created after verifying it's Presence and visibility on Page at Run-Time.

Project Page

https://github.com/NayakwadiS/selenium-page-factory

Project Documentation with Examples

https://selenium-page-factory.readthedocs.io

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

selenium-page-factory-1.8.tar.gz (4.7 kB view details)

Uploaded Source

File details

Details for the file selenium-page-factory-1.8.tar.gz.

File metadata

  • Download URL: selenium-page-factory-1.8.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/39.2.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.4rc1

File hashes

Hashes for selenium-page-factory-1.8.tar.gz
Algorithm Hash digest
SHA256 19a156062aefee2e93ce488c59df4036d8998ec3d42f103c4e474b8f020e5968
MD5 11e746a020627608b25bd6a26e3ad06e
BLAKE2b-256 5c78d96d8179a1f8a97b12909f23413d752a2ad3ec44526bce061788d2e2442e

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