Skip to main content

A Selenium Page Factory implementation for Python

Project description

selenium-pagefactory-impl

GitHub license

A Selenium Page Factory implementation for Python, providing enhanced functionality for web automation.

Features

  • Simplified and intelligent page factory for Selenium projects.
  • Convenient methods for interacting with web elements.
  • Improved handling of StaleElementReferenceException.

Installation

Use Poetry to install the package and its dependencies:

poetry install

How to implement in the test

# Import the PageFactory class
from selenium_pagefactory.page_factory_impl import PageFactory

# Your page class using PageFactory
class YourPageClass:
    # Define locators
    locators = {
        'element_name': (By.XPATH, "//your/xpath"),
        # Add more locators as needed
    }

    # Initialize elements using PageFactory
    def __init__(self, driver):
        self.driver = driver
        PageFactory.initialize_elements(self, driver)

# Example usage
driver = webdriver.Chrome()
page_instance = YourPageClass(driver)
page_instance.element_name.click()

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

Special thanks to the Selenium and pytest communities.

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_pagefactory_impl-0.1.0.tar.gz (2.4 kB view hashes)

Uploaded Source

Built Distribution

selenium_pagefactory_impl-0.1.0-py3-none-any.whl (3.0 kB view hashes)

Uploaded Python 3

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