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.
  • Added Selenium 4 support for ActionChains methods
  • Supports Selenium 4 ActionChains methods
  • Raised custom Page factory exceptions

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,Default 10sec)
        self.highlight = True   	#(Optional - To highlight every webElement in PageClass)
		self.mobile_test = False    #(Optional - Added for Appium support)

Extended WebElements 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 highlight
is_Enabled is_Checked
getAttribute hover
visibility_of_element_located invisibility_of_element_located
element_to_be_clickable text_to_be_present_in_element
context_click execute_script
click_and_hold release
hover_with_offset Coming soon...

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

Documentation

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-2.7.tar.gz (6.7 kB view details)

Uploaded Source

File details

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

File metadata

  • Download URL: selenium-page-factory-2.7.tar.gz
  • Upload date:
  • Size: 6.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.5

File hashes

Hashes for selenium-page-factory-2.7.tar.gz
Algorithm Hash digest
SHA256 6803a2e06c2499571c8dffe163524d1cfb09ff28b35d0da5fc25e33647bd9754
MD5 3dc372ffd78ad0e1d7cf8737406915e1
BLAKE2b-256 e03c12698824b996b5c6f510b43c5ec8beaf85052621b1c3a83ee967c6b5e4da

See more details on using hashes here.

Supported by

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