Principle:MarketSquare Robotframework browser Installation Verification
| Knowledge Sources | |
|---|---|
| Domains | Testing, Installation |
| Last Updated | 2026-02-12 04:00 GMT |
Overview
Verifying the installation of a multi-component test automation stack involves querying the version of each layer to confirm that all parts are present and compatible with one another.
Description
The robotframework-browser library operates as a layered system with three major version-sensitive components:
- Browser Library (Python): The Robot Framework keyword library that provides the test automation API. Its version is stored in
Browser/version.pyas the__version__variable. - Robot Framework: The test execution framework that loads and runs the Browser library. Its version is queried via
python -m robot --version. - Playwright (Node.js): The browser automation engine that controls the actual browsers. Its version is determined by running
npm list playwrightin theBrowser/wrapper/directory, or by parsing the version frompackage.jsonif npm is not available.
Why Version Verification Matters:
Version mismatches between these components are a common source of installation issues. For example:
- An outdated Playwright version may lack support for newer browser features
- A version mismatch between the Browser library and its Node.js dependencies can cause gRPC protocol incompatibilities
- An incompatible Robot Framework version may fail to load the library
The rfbrowser --version command provides a single point of verification by displaying all three version numbers together. This output is invaluable for:
- Confirming a fresh installation succeeded
- Diagnosing test failures caused by version incompatibilities
- Providing version information in bug reports
- Validating CI/CD environment configurations
Version Detection Methods:
| Component | Detection Method | Fallback |
|---|---|---|
| Browser Library | Parse __version__ from Browser/version.py using regex |
Reports "unknown" |
| Robot Framework | Run python -m robot --version and parse stdout |
Reports empty string |
| Playwright | Run npm list playwright in wrapper directory and parse the @version suffix |
Parse version from package.json dependencies field
|
The Playwright version detection distinguishes between an "Installed" version (successfully queried from npm) and a "Required" version (parsed from package.json when npm fails). This distinction helps diagnose whether Node.js dependencies have been properly initialized.
Usage
Run rfbrowser --version in the following scenarios:
- After initial installation: To confirm all components are correctly installed
- After upgrading: To verify that all components have been updated to compatible versions
- When debugging test failures: To rule out version mismatch issues
- In CI/CD pipelines: As an early validation step before running tests
- When reporting bugs: To provide complete environment information
Theoretical Basis
The version checking logic can be expressed as:
FUNCTION print_version():
1. Read Browser/version.py file content
2. Extract version string using regex pattern: "\d+\.\d+.\d+"
IF match found: browser_lib_version = matched string
ELSE: browser_lib_version = "unknown"
3. Run subprocess: python -m robot --version
Parse stdout: split by space, take third token
rf_version = parsed version string
4. Run subprocess: npm list playwright
Working directory: Browser/wrapper/
IF exit code == 0:
Parse stdout with regex: (@[^@]*)$ to extract version suffix
Strip "@" prefix and whitespace
pw_version = Version(parsed_string, from_cmd=True)
ELSE (npm not available or node_modules missing):
Read Browser/wrapper/package.json
Parse "playwright" dependency version using regex: \d+\.\d+\.\d+
pw_version = Version(parsed_string, from_cmd=False)
5. Display:
"Installed Browser library version is: {browser_lib_version}"
"Installed Robot Framework version: {rf_version}"
IF pw_version.from_cmd:
"Installed Playwright is: {pw_version.version}"
ELSE:
"Required Playwright is: {pw_version.version}"