Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

License

NotificationsYou must be signed in to change notification settings

NayakwadiS/selenium-page-factory

Repository files navigation

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

PythonPypiDependenciesLicenseDocumentationDownloads

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

  pip install selenium-page-factory

Pre-Requisite

Every Page in Page Object Model should have WebDriver object as class memberas shown below

classPageClass(PageFactory):def__init__(self,driver):self.driver=driver# Requiredself.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_textget_text
clear_textclick_button
double_clickget_list_item_count
select_element_by_textselect_element_by_index
select_element_by_valueget_all_list_item
get_list_selected_itemhighlight
is_Enabledis_Checked
getAttributehover
visibility_of_element_locatedinvisibility_of_element_located
element_to_be_clickabletext_to_be_present_in_element
context_clickexecute_script
click_and_holdrelease
hover_with_offsetComing soon...

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 Examplehere

About

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

Topics

Resources

License

Stars

Watchers

Forks

Languages


[8]ページ先頭

©2009-2025 Movatter.jp