Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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

⚡ Python library provides page factory approach to implement page object model in selenium
https://github.com/nayakwadis/selenium-page-factory

page-factory pageobjectmodel pom python selenium selenium-webdriver webelement webelements-methods

Last synced: about 1 month ago
JSON representation

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

Awesome Lists containing this project

README

        

selenium-page-factory
=====================

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

![Python](https://img.shields.io/badge/python-v3.7+-blue.svg)
[![Pypi](https://img.shields.io/badge/Pypi-v2.6-green)](https://pypi.org/project/selenium-page-factory/)
![Dependencies](https://img.shields.io/badge/dependencies-up%20to%20date-brightgreen.svg)
![License](https://img.shields.io/pypi/l/selenium-wire.svg)
[![Documentation](https://img.shields.io/badge/Documantation-latest-brightgreen)](https://selenium-page-factory.readthedocs.io/en/latest/)
![Downloads](https://img.shields.io/pypi/dm/selenium-page-factory)

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

Installation
=============

```shell
pip install selenium-page-factory
```

Pre-Requisite
=============
Every Page in Page Object Model should have WebDriver object as class member
as shown below

```python
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
Coming soon...

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

*[selenium-page-factory Documentation](https://selenium-page-factory.readthedocs.io)*

Selenium Python Framework Example *[here](https://github.com/NayakwadiS/Selenium_Python_UnitTest_HTML)*