Skip to main content

selenium-page-factory

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

Python Pypi Dependencies License Documentation Downloads

Introduction

  • 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 / 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.
  • Supports Selenium 4 ActionChains methods
  • Now Support Appium for mobile testing
  • Raised custom Page factory exceptions
  • NEW: Multiple elements support for lists and tables
  • NEW: Scroll into view functionality
  • NEW: Drag and drop support
  • NEW: Click with retry mechanism for handling flaky tests

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)
	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 scroll_into_view
drag_and_drop_to click_with_retry

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

selenium-page-factory Documentation

Selenium Python Framework Example here

Metadata

Release files for selenium-page-factory 2.8

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

Source distribution (sdist)

Source distribution for selenium-page-factory 2.8
File Size Uploaded
selenium_page_factory-2.8.tar.gz 43.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for selenium-page-factory 2.8
File Interpreter ABI Platform
selenium_page_factory-2.8-py3-none-any.whl Python 3 none any Details

Total release size: 51.2 kB

Release files / selenium_page_factory-2.8.tar.gz

Download URL selenium_page_factory-2.8.tar.gz
Size 43.3 kB
Tags Source
SHA-256 checksum
How to use checksums
903194a8d11d6f7b53536bd2c595260069d9159bcbe1b28bc49eae811864274f
BLAKE2b-256 checksum
How to use checksums
79dd4d95120a9e511b5f0649e88f766e4076871f6784a44aac8c4975d09ec141
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Release files / selenium_page_factory-2.8-py3-none-any.whl

Download URL selenium_page_factory-2.8-py3-none-any.whl
Size 7.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bb4d48c76bb1717bb167200f31b7495b2698a4a97d746959b558e60fc3bc931d
BLAKE2b-256 checksum
How to use checksums
7f8776ef2ce6cc1b18a2518bfbc0b62bf0011b79f1f5b2dfbc9f94afb6aa1d9a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Release history Release notifications | RSS feed

This release

2.8 This release

2 release files

2.7

1 release file

2.6

1 release file

2.5

1 release file

2.4

1 release file

2.3

1 release file

2.2

1 release file

2.1

1 release file

2.0

1 release file

1.9

1 release file

1.8

1 release file

1.7

1 release file

1.6

1 release file

1.5

1 release file

1.4

1 release file

1.3

1 release file

1.2

1 release file

1.1

1 release file

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