https://github.com/wgnet/webium
Webium is a Page Object pattern implementation library for Python (http://martinfowler.com/bliki/PageObject.html). It allows you to extend WebElement class to your custom controls like Link, Button and group them as pages.
https://github.com/wgnet/webium
page-object python selenium selenium-webdriver webdriver
Last synced: 2 months ago
JSON representation
Webium is a Page Object pattern implementation library for Python (http://martinfowler.com/bliki/PageObject.html). It allows you to extend WebElement class to your custom controls like Link, Button and group them as pages.
- Host: GitHub
- URL: https://github.com/wgnet/webium
- Owner: wgnet
- License: apache-2.0
- Created: 2015-01-16T09:51:41.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2017-01-04T22:03:32.000Z (over 8 years ago)
- Last Synced: 2025-02-05T16:13:24.856Z (3 months ago)
- Topics: page-object, python, selenium, selenium-webdriver, webdriver
- Language: Python
- Size: 1.34 MB
- Stars: 161
- Watchers: 28
- Forks: 37
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Webium
[](https://pypi.python.org/pypi/webium)
[](https://pypi.python.org/pypi/webium)
[](https://travis-ci.org/wgnet/webium)Webium is a Page Object pattern implementation library for Python (http://martinfowler.com/bliki/PageObject.html).
It allows you to extend WebElement class to your custom controls like Link, Button and group them as pages.
## Installation
The latest stable version is available on PyPI:
pip install webium
## Usage
Main classes are:
- webium.Find
- webium.Finds
- webium.BasePageBasic usage example:
```python
from selenium.webdriver.common.by import By
from selenium.webdriver.remote.webelement import WebElement
from webium.controls.link import Link
from webium.driver import get_driver
from webium import BasePage, Find, Findsclass GooglePage(BasePage):
url = 'http://www.google.com'text_field = Find(by=By.NAME, value='q')
button = Find(by=By.NAME, value='btnK')class ResultItem(WebElement):
link = Find(Link, By.XPATH, './/h3/a')class ResultsPage(BasePage):
stat = Find(by=By.ID, value='resultStats')
results = Finds(ResultItem, By.XPATH, '//div/li')if __name__ == '__main__':
home_page = GooglePage()
home_page.open()
home_page.text_field.send_keys('Page Object')
home_page.button.click()
results_page = ResultsPage()
print('Results summary: ' + results_page.stat.text)
for item in results_page.results:
print(item.link.text)
get_driver().quit()
```More usage details are available here: http://wgnet.github.io/webium/