Skip to main content

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


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)

Uploaded Source

Built Distribution

citronella-0.0.2-py3-none-any.whl (17.5 MB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page