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


Build docker image:

docker build --cache-from -f docker/Dockerfile -t .

check lint:

docker-compose run flake8

run selenium(ui) test:

docker-compose run test-se -n 8

run request test:

docker-compose run test-requests -n 8

run unit test:

docker-compose run test-unit -n 8

Build documentation:

docker-compose run doc

Run test into container:

docker run -e SE_DRIVER=http+chrome:// -e HEADLESS=Enabled --net=host -it pytest -p no:warnings -p no:cacheprovider -v -m se -n 4

Project details

Download files

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

Files for Promium, version 2.2.21
Filename, size File type Python version Upload date Hashes
Filename, size Promium-2.2.21.tar.gz (40.6 kB) File type Source Python version None Upload date Hashes View hashes

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 DigiCert DigiCert EV certificate StatusPage StatusPage Status page