Skip to main content

PySelPOM is a Page Object Model selenium based framework for humans.

Project description

Github-flavored Markdown


PySelPOM is a Page Object Model selenium based framework for humans. It allows you to write your own web test with no need to look under the framework hood in most cases.


For most users, the recommended method to install is via pip:

pip install pyselpom

or from source:

python install

Conftest content

import pytest
from selenium import webdriver
from import Options

def pytest_addoption(parser):
    parser.addoption('--language', action='store', default='en', help='Specify language param.')
    parser.addoption('--browser_name', action='store', default='chrome', help='Choose browser: chrome or firefox')

def driver(request) -> webdriver:
    user_language = request.config.getoption('language')
    browser_name = request.config.getoption('browser_name')

    if browser_name == 'chrome':
        print('\nStart chrome browser for test...')
        options = Options()
        # noinspection PyTypeChecker
        options.add_experimental_option('prefs', {'intl.accept_languages': user_language})
        browser = webdriver.Chrome(options=options)
    elif browser_name == 'firefox':
        print('\nStart firefox browser for test...')
        fp = webdriver.FirefoxProfile()
        fp.set_preference('intl.accept_languages', user_language)
        browser = webdriver.Firefox(firefox_profile=fp)
        raise pytest.UsageError('--browser_name should be chrome or firefox')

    yield browser


Page example

from pyselpom import BasePage

class MainPage(BasePage):
    URL_PATTERN = ''

class LoginPage(BasePage):
    link = ''

    def should_be_login_page(self):

    def should_be_login_url(self):
        assert 'login' in self.browser.current_url

    def should_be_login_form(self):
        assert self.is_element_present(*LoginPageLocators.LOGIN_FORM), 'Login form does not exist.'

    def should_be_register_form(self):
        assert self.is_element_present(*LoginPageLocators.REGISTER_FORM), 'Register form does not exist.'

    def register_new_user(self, email, password):


from import By

class LoginPageLocators:
    LOGIN_FORM = (By.ID, 'login_form')
    REGISTER_FORM = (By.ID, 'register_form')
    REGISTER_MAIL = (By.NAME, 'registration-email')
    REGISTER_PASSWORD = (By.NAME, 'registration-password1')
    REGISTER_PASSWORD_CONFIRM = (By.NAME, 'registration-password2')
    REGISTER = (By.NAME, 'registration_submit')

Test example

import pytest

from .pages.login_page import LoginPage
from .pages.main_page import MainPage

class TestLoginFromMainPage:
    def test_guest_can_go_to_login_page(self, browser):
        page = MainPage(browser,
        login_page = LoginPage(browser, browser.current_url)


1.2.3 (2-03-2022)

  • .is_<methods> returns bool now

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

pyselpom-1.2.3.tar.gz (9.1 kB view hashes)

Uploaded source

Built Distribution

pyselpom-1.2.3-py3-none-any.whl (12.5 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page