Webdriver Extension with Page Object Wrapper
Project description
Citronella
Citronella is a selenium webdriver extension with page object wrapper for create a tests a bit simple.
Example Test
a full documentation / demo examples here.
import pytest
from Pages.home.home_page import HomePage
class TestNavigationMenu:
def test_help_page(self):
self.web.driver.get('https://pypi.org/')
self.web.page_object(HomePage)
self.web.page.help_button.click()
assert 'Help' in self.web.driver.title
def test_sponsors_page(self):
self.web.page.sponsors_button.click()
assert 'Sponsors' in self.web.driver.title
def test_login_page(self):
self.web.page.login_button.click()
assert 'Log' in self.web.driver.title
def test_register_page(self):
self.web.page.register_button.click()
assert 'Create' in self.web.driver.title
Install Package
pip install citronella
Documentation
There's only 2 modules import in this package.
- first module for
conftest.py
import pytest
from selenium import webdriver
from citronella import WebPage
@pytest.fixture(autouse=True, scope='class')
def browser(request):
driver = webdriver.Chrome()
web = WebPage(driver)
request.cls.web = web
yield
driver.quit()
- second module for
Page Object Model
from selenium.webdriver.common.by import By
from citronella import Ui
from Pages.component.HeaderMenu import HeaderMenu
class HomePage(HeaderMenu):
def some_button(self):
return Ui(By.XPATH, '//a[@name="foo"]')
def search_input(self):
return Ui(By.ID, 'search')
def search_button(self):
from Pages.SearchPage import SearchPage
return Ui(By.NAME, 'search-button', SearchPage)
Usage
citronella.WebPage
Args:
- webdriver
Method Lists:
citronella.Ui
Args:
- selenium_by
- string_locator
- new_page_object
Method Lists:
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
citronella-0.0.2.tar.gz
(11.2 kB
view hashes)
Built Distribution
citronella-0.0.2-py3-none-any.whl
(17.5 MB
view hashes)
Close
Hashes for citronella-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a623f0663331b4b1cbb60f1e27f7e887aea3a95407df9c6d9081af091f65b71e |
|
MD5 | 44cd63a808f8f8b784089e5162241bc6 |
|
BLAKE2b-256 | 1a7a2c8038359df44b36b23f6698d6c240e894593042443b358930c0152c4486 |