skillfed

pytest-selenium

pytest plugin for Selenium

pytest-selenium v4.1.0 504.5K downloads/30d#6,297 on PyPI352
Copyleft license Active released

What it is and what it does

pytest-selenium bridges pytest and Selenium WebDriver, allowing you to write browser-based UI tests using pytest's fixture and parametrization system. It depends on pytest, selenium, requests, tenacity, and several pytest plugins (pytest-html, pytest-variables, pytest-base-url) to provide a cohesive testing environment. The plugin handles the plumbing of WebDriver lifecycle and test reporting, so you focus on test logic rather than browser setup.

The package is designed for teams running web automation tests at scale—it supports Python 3.8 through 3.12 and works on macOS, Windows, and POSIX systems. With active maintenance since 2015 and a recent commit on 2026-05-25, it is a mature choice in the pytest ecosystem for UI testing, though you will still need to manage WebDriver binaries and browser compatibility separately.

Use it for:

  • Write cross-browser UI tests for web applications using pytest's familiar syntax and fixtures.
  • Integrate browser-based tests into CI/CD pipelines with pytest's reporting and plugin ecosystem.
  • Automate regression testing of web interfaces across multiple browsers and operating systems.
  • Combine Selenium tests with unit tests in a single pytest suite for end-to-end validation.
  • Leverage pytest parametrization to run the same UI test against different browsers or data sets.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

pytest-selenium is a pytest plugin that integrates Selenium WebDriver into pytest test suites, enabling browser automation and web UI testing within the pytest framework.

Yes, if you are building browser automation tests and want to use pytest. The plugin is stable, actively maintained, has low install friction, and integrates cleanly with pytest's ecosystem. The MPL 2.0 copyleft license is a consideration for proprietary codebases. No known vulnerabilities.

Install

pytest-selenium on PyPI

pip

pip install pytest-selenium

uv

uv add pytest-selenium

poetry

poetry add pytest-selenium

Installing pytest-selenium

Before you install

Low install friction with a pure-wheel distribution. The package is actively maintained (last commit 2026-05-25) and marked Production/Stable, with support across Python 3.8, 3.9, 3.10, 3.11, and 3.12 on CPython and PyPy.

License in practice

Licensed under Mozilla Public License 2.0 (MPL 2.0), a copyleft license. This requires derivative works to be distributed under the same license and disclose source code changes, which may constrain proprietary use.

Quickstart

pip install pytest-selenium

import pytest
from selenium import webdriver

# Use pytest fixtures provided by the plugin
def test_example(selenium):
    selenium.get('http://example.com')
    assert 'Example' in selenium.title

Requires Selenium WebDriver and a compatible browser driver (e.g., chromedriver, geckodriver) installed and in PATH or configured via environment.

Verify before relying

  • Whether the plugin provides built-in fixtures for common browser setup/teardown patterns beyond what Selenium itself offers.
  • Support for parallel test execution and how it interacts with browser driver management.
  • Integration capabilities with cloud providers like BrowserStack or Sauce Labs (mentioned in keywords but not detailed in excerpt).

Package facts

License not declared (copyleft)
Python support supports the current Python release (>=3.8)
Install friction low — pure-Python wheel
Runtime dependencies 7 — pytest-base-url, pytest-html, pytest-variables, pytest, requests, selenium, tenacity
Maintenance actively maintained — 925 days since the last release
Last repo commit
First released
Downloads 504,519/month — #6,297 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: pytest_selenium-4.1.0-py3-none-any.whl

Keywords: browserstack, pytest, qa, saucelabs, selenium, webqa

Development Status :: 5 - Production/StableFramework :: PytestIntended Audience :: DevelopersLicense :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)Natural Language :: EnglishOperating System :: MacOS :: MacOS XOperating System :: Microsoft :: WindowsOperating System :: POSIXProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: Software Development :: Quality AssuranceTopic :: Software Development :: TestingTopic :: Utilities

Tags

selenium pytest pluginbrowser automation testingweb ui test frameworkselenium webdriver pytestautomated browser testingcross-browser test automationselenium test fixtures
browser-automationui-testingselenium-integration

More Utilities packages