You have a couple of straightforward options to check the installed version of Playwright for Python.
The recommended method is using the command line tool that comes with the Playwright package, or you can check it directly within a Python environment.
1. Using the Command Line Interface (CLI)
After installing Playwright, the simplest way to check the version from your terminal or command prompt is to execute the Python module:
Bash
python -m playwright --version
This command directly queries the installed Playwright module for its version number.
2. Checking in a Python Script/REPL
You can also import a special internal variable within a Python environment to get the version.
- In your terminal or command prompt (using the Python REPL):Bash
python>>> from playwright._repo_version import version
>>> print(version) # Output will be the version number, e.g., 1.56.0
- In a Python script:Python
from playwright._repo_version import versionprint(f"Playwright version: {version}")
The video below shows the process of installing and getting started with Playwright for Python, which covers setting up the environment.
3. Set playwright version
pip install playwright==1.50.0