pytest-selenium
pytest plugin for Selenium
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-seleniumuv
uv add pytest-seleniumpoetry
poetry add pytest-seleniumInstalling 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
Tags
More Utilities packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
charset-normalizerDetects and normalizes text encoding from…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
PygmentsPygments is a syntax highlighter that colorizes…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
browserstack-sdkA Python SDK for running Selenium WebDriver…
unclear · top 15,000 on PyPI
pytest-base-urlA pytest plugin that injects a configurable…
copyleft · top 5,000 on PyPI
pytest-cppA pytest plugin that discovers and runs C++…
permissive · top 15,000 on PyPI
pytest-htmlGenerates HTML reports for pytest test results,…
copyleft · top 1,000 on PyPI
pytest-qtpytest-qt is a pytest plugin that provides…
permissive · top 5,000 on PyPI
pytest-variablesA pytest plugin that loads test variables from…
copyleft · top 15,000 on PyPI
pytest-xprocesspytest-xprocess manages external processes…
permissive · top 15,000 on PyPI
pytest-djangopytest-django integrates Django with pytest,…
permissive · top 1,000 on PyPI
seleniumbaseSeleniumBase is a browser automation framework…
permissive · top 5,000 on PyPI
pytest-xmlA pytest plugin that generates XML output from…
unclear · top 15,000 on PyPI