Exit course
Chapter 2 of 10 Beginner 5 min read 2 quick checks Updated

Install Robot Framework in a Python virtual environment

On this page
  1. Create the project and the virtual environment
  2. Pin the libraries
  3. Initialise the Browser library
  4. Check the installation
  5. Editor support

Robot Framework and its libraries are ordinary Python packages. Install them per project, in a virtual environment, with pinned versions. That is the difference between a suite that runs the same on every laptop and CI agent and one that breaks the day somebody upgrades a library globally.

Create the project and the virtual environment#

mkdir robot-course && cd robot-course
python3 -m venv .venv
source .venv/bin/activate          # Windows: .venv\Scripts\activate
python --version
Python 3.13.5

Any Python from 3.11 up works for everything in this course. Once the environment is active, python and pip refer to the copies inside .venv, and so will the robot, pabot and rfbrowser commands you are about to install. Add .venv/ to .gitignore.

Pin the libraries#

Create requirements.txt:

robotframework==7.5.1
robotframework-seleniumlibrary==6.9.0
robotframework-browser==21.0.0
robotframework-pabot==5.2.2

and install it:

pip install -r requirements.txt

What each line brings:

  • robotframework is the runner: the robot and rebot commands and the standard libraries (BuiltIn, Collections, String, OperatingSystem, DateTime and a few more).
  • robotframework-seleniumlibrary pulls in Selenium itself, here 4.52.0. Selenium includes Selenium Manager, which finds or downloads the right ChromeDriver or GeckoDriver the first time you open a browser. You do not download drivers by hand or put them on the PATH.
  • robotframework-browser is the Playwright-based library. It is a Python package that talks to a Node.js process, so it needs one more step, below.
  • robotframework-pabot adds the pabot command for parallel runs (chapter 7).

Pinning exact versions means an upgrade is a deliberate change you review, not something that happens to you on a Monday morning. When you do upgrade, change the file, reinstall and run the suite.

A colleague's tutorial says to download chromedriver, unzip it and add it to the PATH before running SeleniumLibrary tests. With the versions above, what do you need to do?

Selenium Manager has been part of Selenium since 4.6 and SeleniumLibrary uses it automatically. A driver on the PATH still works, but an outdated one is a common cause of "session not created" errors after a browser update.

Initialise the Browser library#

The Browser library ships the Node.js side as source and installs its dependencies with:

rfbrowser init chromium
...
[INFO ] rfbrowser init completed

Without an argument, rfbrowser init downloads Chromium, Firefox and WebKit, a few hundred megabytes. Naming a browser installs only that one. For runs that only connect to a remote grid you need no local browser at all: rfbrowser init --skip-browsers installs the Node dependencies only.

This step needs Node.js 22, 24 or 26 on the machine. If installing Node is not an option, pip install "robotframework-browser[bb]" adds a package with Node bundled; the Browser library README explains both routes.

Every time you upgrade the Browser library, run rfbrowser clean-node and rfbrowser init again. The Python package and the Node side must match; a mismatch shows up as confusing errors on the first keyword.

Check the installation#

robot --version
Robot Framework 7.5.1 (Python 3.13.5 on darwin)

The libdoc tool, which ships with Robot Framework, prints the documentation of any library. It is the fastest way to look up a keyword's exact arguments without leaving the terminal:

python -m robot.libdoc SeleniumLibrary list Wait
Get Selenium Implicit Wait
Set Browser Implicit Wait
Set Selenium Implicit Wait
Wait For Condition
Wait For Expected Condition
Wait Until Element Contains
Wait Until Element Does Not Contain
Wait Until Element Is Enabled
Wait Until Element Is Not Visible
Wait Until Element Is Visible
Wait Until Location Contains
...

python -m robot.libdoc SeleniumLibrary SeleniumLibrary.html writes the full keyword documentation as an HTML page you can keep open while writing tests.

Editor support#

Robot Framework files are plain text, so any editor works, but proper support makes a large difference: keyword completion, go-to-definition into resource files and errors for unknown keywords before you run anything. The RobotCode extension for VS Code (also available for IntelliJ-based IDEs) uses the same virtual environment as your project; point the editor's Python interpreter at .venv.

After pip install -U robotframework-browser, every Browser library test fails on its first keyword with an error from the Node.js side. What should you run?

The Python package and its Node.js dependencies are versioned together. After an upgrade the old Node side is still installed, so it has to be cleaned and initialised again. The Python playwright package is not used by the Browser library at all.

With the tools in place, the next chapter writes and runs the first test.