Skip to main content

Selenium wrapper for testing Web UI

Project description

https://gitlab.uaprom/uaprom/promium/badges/master/pipeline.svg https://gitlab.uaprom/uaprom/promium/badges/master/coverage.svg

Simple selenium wrapper from implemented UI tests

Watch documentation

Quick Start



pip install promium


pip install selenium


# get actual chrome driver version

# download chrome driver
wget --no-verbose -O /tmp/$CHROME_DRIVER_VERSION/

# unpack
unzip /tmp/ -d /opt/selenium

# add link from chrome driver
ln -fs /opt/selenium/chromedriver /usr/bin/chromedriver


Page Objects

from import By

from promium import Page, Block, Element, InputField, Link

class ResultBlock(Block):

    title = Link(By.CSS_SELECTOR, 'h3')
    link = Element(By.CSS_SELECTOR, '.f')
    description = Element(By.CSS_SELECTOR, '.st')
    tags = Element.as_list(By.CSS_SELECTOR, '.osl .fl')

class GoogleResultPage(Page):

    results_blocks = ResultBlock.as_list(By.CSS_SELECTOR, '#rso .srg div.g')

class GoogleMainPage(Page):

    url = ''
    logo = Element(By.CSS_SELECTOR, '#hplogo')
    search_input = InputField(By.CSS_SELECTOR, '[name="q"]')

    def search(self, text):
        return GoogleResultPage(self.driver)

Simple test from google page

from promium.test_case import WebDriverTestCase

from tests.pages.google_page import GoogleMainPage

class TestMainGooglePage(WebDriverTestCase):

    def test_search(self):
        main_page = GoogleMainPage(self.driver)
        result_page ='Selenium')
        result_block = result_page.results_blocks.first_item
        self.soft_assert_in('Selenium', result_block.title.text)

Run test

# all tests
pytest tests/

# all tests in suite
pytest tests/

# only one test
pytest tests/ -k test_search

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
Promium-1.0.2.tar.gz (35.7 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page