Robot Framework Browser library
Robot Framework Browser library (robotframework-browser) is a web testing library for Robot Framework that uses Playwright internally for browser automation. It aims for speed, reliability, and visibility in web testing. The library has a rapid release cadence, frequently publishing hotfixes and minor versions, often on a monthly or bi-weekly basis.
Warnings
- breaking Python 3.8 support was dropped with version 18.9.0. Users on Python 3.8 or older must upgrade their Python environment to Python 3.9+ (or higher, as latest versions require 3.10+).
- breaking The `Browser/utils/robot_booleans.py` module was removed in version 19.14.0. If you were directly importing or referencing this internal module, your tests will break.
- gotcha After `pip install robotframework-browser`, it is crucial to run `rfbrowser init` (or `python -m Browser.entry init`) to download necessary browser binaries and Node.js dependencies. Forgetting this step will lead to 'Couldn't execute node' or similar errors when tests run.
- gotcha The `grpcio` dependency, which is used for communication between Python and Node.js, has historically caused installation and runtime issues, especially on macOS (M1/ARM) or with specific Python versions (e.g., building wheels failing). Version 19.12.7 specifically downgraded `grpcio` to 1.78.0 to address issues.
- gotcha The Browser library uses a different paradigm (Browser, Context, Page layers) compared to older Selenium-based libraries. Directly migrating tests from `SeleniumLibrary` without understanding these new concepts can be challenging and lead to incorrect or inefficient test implementations.
- gotcha By default, the Browser library enables 'strict mode' for selectors, meaning keywords will fail if a selector matches multiple elements. This differs from some other web automation libraries.
- gotcha Playing videos in automated tests using Chromium can sometimes fail due to codec problems. This is often an upstream Playwright/Chromium limitation.
Install
-
pip install robotframework-browser rfbrowser init -
pip install robotframework-browser[bb] rfbrowser install
Imports
- Browser
*** Settings *** Library Browser
Quickstart
*** Settings ***
Library Browser
*** Test Cases ***
Example Test
New Page https://playwright.dev
Get Text h1 contains Playwright