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
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 | 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 |
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Close
Hashes for selenium-page-factory-2.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9aff831b16a3745bdbfbf26739c4e4458bfdc9579a8f19a19b3840007cba105d |
|
MD5 | ff55aed55df4091d70d147874294ef60 |
|
BLAKE2b-256 | 3b8c08a0985ca94c358fb63898121ff15c8cdba2fb4c621ed3e18a1e848af54d |