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
=============
```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,Default 10sec)
self.highlight = True #(Optional - To highlight every webElement in PageClass)
self.mobile_test = False #(Optional - Added for Appium support)
```
Extended WebElements Methods
===================
<table>
<tbody>
<tr>
<td >set_text</td>
<td >get_text</td>
</tr>
<tr>
<td >clear_text</td>
<td >click_button</td>
</tr>
<tr>
<td >double_click</td>
<td >get_list_item_count</td>
</tr>
<tr>
<td >select_element_by_text</td>
<td >select_element_by_index</td>
</tr>
<tr>
<td >select_element_by_value</td>
<td >get_all_list_item</td>
</tr>
<tr>
<td >get_list_selected_item</td>
<td >highlight</td>
</tr>
<tr>
<td >is_Enabled</td>
<td >is_Checked</td>
</tr>
<tr>
<td >getAttribute</td>
<td >hover</td>
</tr>
<tr>
<td >visibility_of_element_located</td>
<td >invisibility_of_element_located</td>
</tr>
<tr>
<td >element_to_be_clickable</td>
<td >text_to_be_present_in_element</td>
</tr>
<tr>
<td >context_click</td>
<td >execute_script</td>
</tr>
<tr>
<td >click_and_hold</td>
<td >release</td>
</tr>
<tr>
<td >hover_with_offset</td>
<td >Coming soon...</td>
</tr>
</tbody>
</table>
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
Raw data
{
"_id": null,
"home_page": "https://github.com/NayakwadiS/selenium-page-factory",
"name": "selenium-page-factory",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "selenium, page object model, pom, pages, page factory",
"author": "Sujit Nayakwadi",
"author_email": "nayakwadi_sujit@rediffmail.com",
"download_url": "https://files.pythonhosted.org/packages/e0/3c/12698824b996b5c6f510b43c5ec8beaf85052621b1c3a83ee967c6b5e4da/selenium-page-factory-2.7.tar.gz",
"platform": null,
"description": "A Page Factory is one way of implementing a Page Object Model. In order to support the Page Object pattern.\nAs in Java we are using @findBy, here we are declaring all web element in dictionary.\nDictionary keys become WebElement or class member variable with having all extended WebElement methods.\n \n\nMain Features\n=============\n\n* Initialise all the webElements declared in Point at a time.\n* All WebElements methods are re-define to add extra features eg- click method extended to have explicit wait for element to be clickable.\n* Cent percent unittest coverage.\n* Added Selenium 4 support for ActionChains methods\n* Supports Selenium 4 ActionChains methods\n* Raised custom Page factory exceptions\n\nInstallation\n=============\n\n```shell\n pip install selenium-page-factory\n```\n\nPre-Requisite\n=============\nEvery Page in Page Object Model should have WebDriver object as class member\nas shown below\n\n```python\nclass PageClass(PageFactory):\n\n def __init__(self,driver):\n self.driver = driver \t# Required\n self.timeout = 15 \t\t#(Optional - Customise your explicit wait for every webElement,Default 10sec)\n self.highlight = True \t#(Optional - To highlight every webElement in PageClass)\n\t\tself.mobile_test = False #(Optional - Added for Appium support)\n```\n\nExtended WebElements Methods\n===================\n<table>\n <tbody>\n <tr>\n <td >set_text</td>\n <td >get_text</td>\n </tr>\n <tr>\n <td >clear_text</td>\n <td >click_button</td>\n </tr>\n <tr>\n <td >double_click</td>\n <td >get_list_item_count</td>\n </tr>\n\t<tr>\n <td >select_element_by_text</td>\n <td >select_element_by_index</td>\n </tr>\n\t<tr>\n <td >select_element_by_value</td>\n <td >get_all_list_item</td>\n </tr>\n\t<tr>\n <td >get_list_selected_item</td>\n <td >highlight</td>\n </tr>\n\t<tr>\n <td >is_Enabled</td>\n <td >is_Checked</td>\n </tr>\n\t<tr>\n <td >getAttribute</td>\n <td >hover</td>\n </tr>\n\t<tr>\n <td >visibility_of_element_located</td>\n <td >invisibility_of_element_located</td>\n </tr>\n\t<tr>\n <td >element_to_be_clickable</td>\n <td >text_to_be_present_in_element</td> \n </tr>\n\t<tr>\n <td >context_click</td>\n <td >execute_script</td> \n </tr>\n\t<tr>\n <td >click_and_hold</td>\n <td >release</td> \n </tr>\n\t<tr>\n <td >hover_with_offset</td>\n <td >Coming soon...</td> \n </tr>\n </tbody>\n</table>\n\n Note: \n Every WebElement will be created after verifying it's Presence and visibility on Page at Run-Time. \n \n\nProject Page\n=============\nhttps://github.com/NayakwadiS/selenium-page-factory\n\n\nDocumentation\n==============\nhttps://selenium-page-factory.readthedocs.io",
"bugtrack_url": null,
"license": "MIT",
"summary": "Python library provides page factory approach to implement page object model in selenium",
"version": "2.7",
"project_urls": {
"Homepage": "https://github.com/NayakwadiS/selenium-page-factory"
},
"split_keywords": [
"selenium",
" page object model",
" pom",
" pages",
" page factory"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "e03c12698824b996b5c6f510b43c5ec8beaf85052621b1c3a83ee967c6b5e4da",
"md5": "3dc372ffd78ad0e1d7cf8737406915e1",
"sha256": "6803a2e06c2499571c8dffe163524d1cfb09ff28b35d0da5fc25e33647bd9754"
},
"downloads": -1,
"filename": "selenium-page-factory-2.7.tar.gz",
"has_sig": false,
"md5_digest": "3dc372ffd78ad0e1d7cf8737406915e1",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 6703,
"upload_time": "2024-04-14T06:21:35",
"upload_time_iso_8601": "2024-04-14T06:21:35.245196Z",
"url": "https://files.pythonhosted.org/packages/e0/3c/12698824b996b5c6f510b43c5ec8beaf85052621b1c3a83ee967c6b5e4da/selenium-page-factory-2.7.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-04-14 06:21:35",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "NayakwadiS",
"github_project": "selenium-page-factory",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "selenium-page-factory"
}