Skip to main content

Robot Framework Browser Recorder

A Python package that records browser interactions using Playwright's codegen feature and automatically converts them to Robot Framework test cases using the Browser library.

Features

  • 🎥 Record browser interactions using Playwright's powerful codegen tool
  • 🤖 Automatic conversion to Robot Framework test syntax
  • 🌐 Multi-browser support: Chromium, Firefox, and WebKit
  • 🎯 Simple CLI for quick test generation
  • 📝 Clean, readable output with simplified selectors (e.g., data-test=login instead of [data-test="login"])

Installation

Prerequisites

  • Python 3.8 or higher
  • Playwright (installed automatically with the package)

Install the package

pip install robotframework-browser-recorder

Install Playwright browsers

After installing the package, you need to install Playwright browsers:

playwright install  # Install all browsers
# OR install specific browsers:
playwright install chromium
playwright install firefox
playwright install webkit

Install Robot Framework Browser library

pip install robotframework-browser
rfbrowser init

Quick Start

Basic Recording

Record browser interactions and generate a Robot Framework test:

rfbrowser-record --url https://example.com

This will:

  1. Open a browser window with the Playwright inspector (Chromium by default)
  2. Navigate to the specified URL
  3. Record all your interactions (clicks, typing, etc.)
  4. Generate a recorded_test.robot file when you close the browser

Run Your Test

After recording, run your test with:

robot recorded_test.robot

Usage

Command Line Interface

rfbrowser-record [OPTIONS]

Options

Option Short Description Default
--url -u Initial URL to navigate to None
--browser -b Browser to use (chromium, firefox, webkit) chromium
--output -o Output file path recorded_test.robot
--test-name -n Name of the test case Recorded Test
--version Show version

Examples

Record with Firefox

rfbrowser-record --browser firefox --url https://example.com

Record with custom output file

rfbrowser-record --url https://example.com --output my_test.robot

Supported Actions

The converter supports the following Playwright actions:

Interactions

Playwright Action Robot Framework Keyword
page.goto(url) New Page url
page.click(selector) or .click() Click selector
page.fill(selector, value) or .fill(value) Type Text selector value
page.press(selector, key) Keyboard Key press key
page.check(selector) or .check() Check Checkbox selector
page.uncheck(selector) or .uncheck() Uncheck Checkbox selector
page.select_option(selector, value) or .select_option(value) Select Options By selector value value
page.set_input_files(selector, file) or .set_input_files(file) Upload File By Selector selector file
page.hover(selector) or .hover() Hover selector
page.dblclick(selector) or .dblclick() Click selector clickCount=2
page.screenshot(path=path) Take Screenshot path
page.wait_for_load_state(state) Wait For Load State state

Assertions / Verifications

Playwright Assertion Robot Framework Keyword
expect(locator).to_be_visible() Get Element States selector validate visible
expect(locator).to_have_text(text) Get Text selector == text
expect(locator).to_contain_text(text) Get Text selector == text
expect(locator).to_have_value(value) Get Property selector value == value
expect(locator).to_be_checked() Get Checkbox State selector == checked
expect(page).to_have_url(url) Get Url == url
expect(page).to_have_title(title) Get Title == title

Example Output

After recording interactions on a website, you'll get a clean Robot Framework test:

*** Settings ***
Library    Browser


*** Test Cases ***
Login Test
    New Browser    chromium    headless=False
    New Context    viewport={'width': 1920, 'height': 1080}
    New Page    https://example.com
    Click    data-test=nav-sign-in
    Type Text    data-test=email    test@test.nl
    Type Text    data-test=password    SuperSecretPassword!
    Click    data-test=login-submit

Notice how selectors are simplified:

  • [data-test="nav-sign-in"] becomes data-test=nav-sign-in
  • [id="submit"] becomes id=submit

Development

Setup Development Environment

# Clone the repository
git clone https://github.com/yourusername/robotframework-browser-recorder.git
cd robotframework-browser-recorder

# Create virtual environment
python3 -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install in development mode
pip install -e ".[dev]"

# Install Playwright
playwright install chromium

Running Tests

pytest tests/

Code Formatting

black robotframework_browser_recorder/

Troubleshooting

Playwright not found

If you get an error about Playwright not being installed:

pip install playwright
playwright install chromium

Browser library not found

Make sure the Robot Framework Browser library is installed:

pip install robotframework-browser
rfbrowser init chromium

Recording produces no output

Make sure you actually perform some interactions in the browser before closing it. The recorder only captures actions like clicks, typing, navigation, etc.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

Apache License 2.0

Acknowledgments

This project builds upon the excellent work of:

  • The Robot Framework community
  • The Playwright team at Microsoft
  • The Browser library maintainers

Metadata

Release files for robotframework-browser-recorder 0.8.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for robotframework-browser-recorder 0.8.1
File Size Uploaded
robotframework_browser_recorder-0.8.1.tar.gz 15.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for robotframework-browser-recorder 0.8.1
File Interpreter ABI Platform
robotframework_browser_recorder-0.8.1-py3-none-any.whl Python 3 none any Details

Total release size: 29.7 kB

Release files / robotframework_browser_recorder-0.8.1.tar.gz

Download URL robotframework_browser_recorder-0.8.1.tar.gz
Size 15.9 kB
Tags Source
SHA-256 checksum
How to use checksums
3d9faf74edf662236a30aa43c61d6d1bae68d68eb76eba88be025f5d6e49510a
BLAKE2b-256 checksum
How to use checksums
071d4b8f62d2737cba6e852380864a8d3bfc7b87f3ffd65d45e9d0c4e273d814
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.14

Release files / robotframework_browser_recorder-0.8.1-py3-none-any.whl

Download URL robotframework_browser_recorder-0.8.1-py3-none-any.whl
Size 13.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4fc91232c7672f7ce136066c575e333740c6e06d5a7bee27a523b0cbd6c32aae
BLAKE2b-256 checksum
How to use checksums
a2f8e49eb659e5038610de1ab335df587b4a77485aaa4f6d47ca6f95d79e6ae3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.14

Release history Release notifications | RSS feed

0.8.2

2 release files

This release

0.8.1 This release

2 release files

0.7.0

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page