Skip to main content
https://img.shields.io/badge/Python%3A%203.13-blue https://badge.fury.io/py/Promium.svg

Promium is a simple Selenium wrapper designed to facilitate writing UI tests.

Promium Documentation

Overview

Promium simplifies the UI testing process using Selenium. The framework is designed for ease of test creation and provides essential tools for working with elements, pages, and test cases. Supports Python 3.13 and works on Linux and macOS.

Installation and Setup

System Requirements

  • Python 3.13

  • Systems: Linux, macOS

To install all dependencies:

pip install -r requirements.txt

Install Promium

pip install promium

Driver and Chrome Setup

To use Promium with Chrome, both Google Chrome and ChromeDriver need to be installed. Use the following commands to set up Chrome and ChromeDriver:

ARG CHROME_MILESTONE=130

#============================================
# Google Chrome
#============================================
RUN CHROME_VERSION=$(curl -s https://googlechromelabs.github.io/chrome-for-testing/LATEST_RELEASE_${CHROME_MILESTONE}) && \
    curl -Lo /tmp/chrome-linux.zip https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/${CHROME_VERSION}/linux64/chrome-linux64.zip && \
    apt-get install -y unzip && \
    unzip /tmp/chrome-linux.zip -d /usr/local/ && \
    ln -s /usr/local/chrome-linux64/chrome /usr/local/bin/google-chrome && \
    rm /tmp/chrome-linux.zip

#============================================
# ChromeDriver
#============================================
RUN CHROME_DRIVER_VERSION=$(curl -s https://googlechromelabs.github.io/chrome-for-testing/latest-versions-per-milestone.json | python3 -c "import sys, json; print(json.load(sys.stdin)['milestones'][str(${CHROME_MILESTONE})]['version'])") && \
    wget --no-verbose -O /tmp/chromedriver_linux64.zip https://storage.googleapis.com/chrome-for-testing-public/${CHROME_DRIVER_VERSION}/linux64/chromedriver-linux64.zip && \
    unzip /tmp/chromedriver_linux64.zip -d /opt/selenium && \
    ln -fs /opt/selenium/chromedriver-linux64/chromedriver /usr/bin/chromedriver && \
    rm /tmp/chromedriver_linux64.zip

Usage Examples

Below is a basic example of how to define a page object and run a simple test. For more examples, refer to the Examples Documentation.

Page Object Example

from selenium.webdriver.common.by 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 = 'https://google.com'
    logo = Element(By.CSS_SELECTOR, '#hplogo')
    search_input = InputField(By.CSS_SELECTOR, '[name="q"]')

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

Test Example

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)
        main_page.open()
        self.soft_assert_element_is_displayed(main_page.logo)
        result_page = main_page.search('Selenium')
        result_block = result_page.results_blocks.first_item
        self.soft_assert_in('Selenium', result_block.title.text)

Run a Simple Test

# all tests
pytest tests/

# all tests in suite
pytest tests/test_google.py

# only one test
pytest tests/test_google.py -k test_search

Development and Testing

To set up a development environment and run tests, use the following commands:

  • Build Docker Image: docker build -t promium/base-env .

  • Run Tests: docker-compose run test-se

  • Check Linting: docker-compose run ruff

Additional Documentation

For detailed information on using and configuring Promium, refer to the following documentation files:

  • Assertions - Description of available assertion methods for validating test conditions.

  • CI Setup - Configuration of CI/CD for automating integration processes.

  • Commands - List of available commands and their usage within the framework.

  • Containers - Information on setting up and using containers for an isolated testing environment.

  • Devices(emulation) - Description of supported devices and configurations.

  • Drivers - Configuration of drivers for browser interaction.

  • Elements - Working with web elements and their properties.

  • Examples - Sample tests and scenarios to get started with the framework.

  • Exceptions - Handling exceptions and errors during testing.

  • Test Cases - Creating and structuring test cases in Promium.

Download files

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

Source Distribution

promium-3.10.1.tar.gz (63.3 kB view details)

Uploaded Source

File details

Details for the file promium-3.10.1.tar.gz.

File metadata

  • Download URL: promium-3.10.1.tar.gz
  • Upload date:
  • Size: 63.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.13.0

File hashes

Hashes for promium-3.10.1.tar.gz
Algorithm Hash digest
SHA256 b8244477bab4b7fabfcac8a8f741b6bbda3f2548b9573547265a206c85c88dad
MD5 d8b76802ad1477094e073c15e81a3db0
BLAKE2b-256 ddfd420a9d41ceee0a0a9d89adabb4ff1ebe85c3070d9a57269b7065ddbf5db6

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

3.10.1 This release

1 file

3.10.0

1 file

3.9.2

1 file

3.9.1

1 file

3.9.0

1 file

3.8.2

1 file

3.8.1

1 file

3.8.0

1 file

3.7.8

1 file

3.7.7

1 file

3.7.6

1 file

3.7.5

1 file

3.7.4

1 file

3.7.3

1 file

3.7.2

1 file

3.7.1

1 file

3.7.0

1 file

3.6.14

1 file

3.6.13

1 file

3.6.12

1 file

3.6.11

1 file

3.6.10

1 file

3.6.9

1 file

3.6.8

1 file

3.6.7

1 file

3.6.6

1 file

3.6.5

1 file

3.6.4

1 file

3.6.3

1 file

3.6.2

1 file

3.6.1

1 file

3.6.0

1 file

3.5.3

1 file

3.5.2

1 file

3.5.1

1 file

3.5.0

1 file

3.4.3

1 file

3.4.2

1 file

3.4.1

1 file

3.4.0

1 file

3.3.30

1 file

3.3.29

1 file

3.3.28

1 file

3.3.25

1 file

3.3.24

1 file

3.3.23

1 file

3.3.22

1 file

3.3.21

1 file

3.3.20

1 file

3.3.19

1 file

3.3.18

1 file

3.3.17

1 file

3.3.16

1 file

3.3.15

1 file

3.3.14

1 file

3.3.13

1 file

3.3.12

1 file

3.3.11

1 file

3.3.10

1 file

3.3.9

1 file

3.3.8

1 file

3.3.7

1 file

3.3.6

1 file

3.3.5

1 file

3.3.4

1 file

3.3.3

1 file

3.3.2

1 file

3.3.1

1 file

3.3.0

1 file

3.2.5

1 file

3.2.4

1 file

3.2.3

1 file

3.2.2

1 file

3.2.1

1 file

3.2.0

1 file

3.1.5

1 file

3.1.4

1 file

3.1.3

1 file

3.1.2

1 file

3.1.1

1 file

3.1.0

1 file

3.0.2

1 file

3.0.1

1 file

3.0.0

1 file

2.4.8

1 file

2.4.7

1 file

2.4.6

1 file

2.4.5

1 file

2.4.4

1 file

2.3.9

1 file

2.3.6

1 file

2.3.5

1 file

2.3.4

1 file

2.3.3

1 file

2.3.2

1 file

2.3.1

1 file

2.3.0

1 file

2.2.21

1 file

2.2.20

1 file

2.2.19

1 file

2.2.18

1 file

2.2.17

1 file

2.2.16

1 file

2.2.15

1 file

2.2.14

1 file

2.2.13

1 file

2.2.12

1 file

2.2.11

1 file

2.2.10

1 file

2.2.9

1 file

2.2.8

1 file

2.2.7

1 file

2.2.6

1 file

2.2.5

1 file

2.2.4

1 file

2.2.3

1 file

2.2.2

1 file

2.2.1

1 file

2.2.0

1 file

2.1.9

1 file

2.1.8

1 file

2.1.7

1 file

2.1.6

1 file

2.1.5

1 file

2.1.4

1 file

2.1.3

1 file

2.1.2

1 file

2.1.1

1 file

2.1.0

1 file

2.0.9

1 file

2.0.8

1 file

2.0.7

1 file

2.0.6

1 file

2.0.5

1 file

2.0.3

1 file

2.0.2

1 file

2.0.1

1 file

2.0.0

1 file

1.2.7

1 file

1.2.6

1 file

1.2.5

1 file

1.2.4

1 file

1.2.3

1 file

1.2.2

1 file

1.2.1

1 file

1.1.7

1 file

1.1.6

1 file

1.1.5

1 file

1.1.4

1 file

1.1.3

1 file

1.1.2

1 file

1.1.1

1 file

1.1.0

1 file

1.0.10

1 file

1.0.9

1 file

1.0.8

1 file

1.0.7

1 file

1.0.6

1 file

1.0.5

1 file

1.0.4

1 file

1.0.3

1 file

1.0.2

1 file

0.0.7

1 file

0.0.6

1 file

0.0.5

1 file

0.0.4

1 file

0.0.3

1 file

0.0.2

1 file

0.0.1

1 file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page