https://github.com/marketsquare/robotframework-browser
Robot Framework Browser library powered by Playwright.
https://github.com/marketsquare/robotframework-browser
playwright robotframework testing
Last synced: 1 day ago
JSON representation
Robot Framework Browser library powered by Playwright.
- Host: GitHub
- URL: https://github.com/marketsquare/robotframework-browser
- Owner: MarketSquare
- License: apache-2.0
- Created: 2020-06-01T20:49:22.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2025-05-12T00:54:13.000Z (1 day ago)
- Last Synced: 2025-05-12T03:15:15.639Z (1 day ago)
- Topics: playwright, robotframework, testing
- Language: Python
- Homepage:
- Size: 15 MB
- Stars: 571
- Watchers: 19
- Forks: 119
- Open Issues: 35
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# robotframework-browser
[](#contributors-)
[](https://pypi.python.org/pypi/robotframework-browser)
[](https://github.com/MarketSquare/robotframework-browser/actions)
[](https://opensource.org/licenses/Apache-2.0)----
[Robot Framework](https://robotframework.org) Browser library powered by [Playwright](https://playwright.dev/). Propelling browser automation into the future!
Aiming for :rocket: speed, :white_check_mark: reliability and :microscope: visibility.
See [keyword documentation](https://marketsquare.github.io/robotframework-browser/Browser.html) and
[web page](https://robotframework-browser.org/) for more details.# Installation instructions
Only Python 3.9 or newer is supported. From Node side 18, 20 and 22 LTS versions are supported.
1. Install node.js e.g. from https://nodejs.org/en/download/
2. Update pip `pip install -U pip` to ensure latest version is used
3. Install robotframework-browser from the commandline: `pip install robotframework-browser`
4. Install the node dependencies: run `rfbrowser init` in your shell
- if `rfbrowser` is not found, try `python -m Browser.entry init`Please note that by default Chromium, Firefox and WebKit browser are installed, even those would be already
installed in the system. The installation size depends on the operating system, but usually is +700Mb.
It is possible to skip browser binaries installation with `rfbrowser init --skip-browsers` command, but then user
is responsible for browser binary installation. It is possible to install only selected browser binaries by adding
`chromium`, `firefox` or `webkit` as arguments to init command. Example `rfbrowser init firefox` would install
only Firefox binaries and `rfbrowser init firefox chromium` would install both Firefox and Chromium binaries.Or use the [docker images](https://github.com/MarketSquare/robotframework-browser/pkgs/container/robotframework-browser%2Frfbrowser-stable). Documented at [docker/README.md](https://github.com/MarketSquare/robotframework-browser/blob/main/docker/README.md).
## Install with transformer
Starting from release 18.3.0 Browser library has optional dependency with
[Robotidy](https://robotidy.readthedocs.io/en/stable/). Install library with Robotidy, run install with:
`pip install robotframework-browser[tidy]`. Starting from 18.3.0 release, library will provide external
Robotidy [transformer](https://robotidy.readthedocs.io/en/stable/external_transformers.html). Transformer provided
by Browser library can be run with command: `rfbrowser transform --transformer-name /path/to/tests`. Example:
`rfbrowser transform --wait-until-network-is-idle /path/to/tests` would transform deprecated `Wait Until Network Is Idle`
keyword to `Wait For Load State` keyword. To see full list of transformers provided by Browser library, run
command: `rfbrowser transform --help`.## Update instructions
To upgrade your already installed robotframework-browser library
1. Update from commandline: `pip install -U robotframework-browser`
2. Clean old node side dependencies and browser binaries: `rfbrowser clean-node`
3. Install the node dependencies for the newly installed version: `rfbrowser init`## Uninstall instructions
To completely uninstall library, including the browser binaries installed by Playwright,
run following commands:
1. Clean old node side dependencies and browser binaries: `rfbrowser clean-node`
2. Uninstall with pip: `pip uninstall robotframework-browser`# Examples
### Testing with [Robot Framework](https://robotframework.org)
```RobotFramework
*** Settings ***
Library Browser*** Test Cases ***
Example Test
New Page https://playwright.dev
Get Text h1 contains Playwright
```
### and testing with [Python](https://python.org).
```python
import Browser
browser = Browser.Browser()
browser.new_page("https://playwright.dev")
assert 'Playwright' in browser.get_text("h1")
browser.close_browser()
```### and extending with JavaScript
```JavaScript
async function myGoToKeyword(url, page, logger) {
logger("Going to " + url)
return await page.goto(url);
}
myGoToKeyword.rfdoc = "This is my own go to keyword";
exports.__esModule = true;
exports.myGoToKeyword = myGoToKeyword;
``````RobotFramework
*** Settings ***
Library Browser jsextension=${CURDIR}/mymodule.js*** Test Cases ***
Example Test
New Page
myGoToKeyword https://www.robotframework.org
```See [example](https://github.com/MarketSquare/robotframework-browser/tree/main/docs/examples/babelES2015).
Ready made extensions and a place to share your own at [robotframework-browser-extensions](https://github.com/MarketSquare/robotframework-browser-extensions).### Ergonomic selector syntax, supports chaining of `text`, `css` and `xpath` selectors
```RobotFramework
# Select element containing text "Login" with text selector strategy
# and select it's parent `input` element with xpath
Click "Login" >> xpath=../input
# Select element with CSS strategy and select button in it with text strategy
Click div.dialog >> "Ok"
```
### Evaluate in browser page
```RobotFramework
New Page ${LOGIN_URL}
${ref}= Get Element h1
Get Property ${ref} innerText == Login Page
Evaluate JavaScript ${ref} (elem) => elem.innerText = "abc"
Get Property ${ref} innerText == abc
```
### Asynchronously waiting for HTTP requests and responses
```RobotFramework
# The button with id `delayed_request` fires a delayed request. We use a promise to capture it.
${promise}= Promise To Wait For Response matcher= timeout=3s
Click \#delayed_request
${body}= Wait For ${promise}
```
### Device Descriptors
```RobotFramework
${device}= Get Device iPhone X
New Context &{device}
New Page
Get Viewport Size # returns { "width": 375, "height": 812 }
```
### Sending HTTP requests and parsing their responses
```RobotFramework
${response}= HTTP /api/post POST {"name": "John"}
Should Be Equal ${response.status} ${200}
```### Parallel test execution using Pabot
You can let RF Browser spawn separate processes for every pabot process. This is very simple, just run the tests normally using pabot (see https://github.com/mkorpela/pabot#basic-use ). However if you have small tests do not use `--testlevelsplit`, it will cause lots of overhead because tests cannot share the browsers in any case.
You can share the node side RF Browser processes by using the `ROBOT_FRAMEWORK_BROWSER_NODE_PORT` environment variable, and `from Browser.utils import spawn_node_process` helper ([see the docs for the helper](https://github.com/MarketSquare/robotframework-browser/blob/a7d3e59a1e8e3e75f64b9146a088385445a5af30/Browser/utils/misc.py#L35) ). This saves some overhead based on how many splits of tests you are running. Clean up the process afterwards.
### Re-using authentication credentials
- Figure out how the page is storing authentication
- If it is localstorage or cookies `Save Storage State` should work. See usage example: https://marketsquare.github.io/robotframework-browser/Browser.html#Save%20Storage%20State# Development
See [CONTRIBUTING.md](CONTRIBUTING.md) for development instructions.
## Core team
In order of appearance.
* Mikko Korpela
* Tatu Aalto
* Janne HΓ€rkΓΆnen (Alumnus)
* Kerkko Pelttari
* RenΓ© Rohner## Contributors
This project is community driven and becomes a reality only through the work of all the people who contribute.
Supported by [Robocorp](https://robocorp.com/) through [Robot Framework Foundation](https://robotframework.org/foundation/).
Mikko Korpela
π»
Tatu Aalto
π»
Antti Karjalainen
π
Ismo Aro
π
Janne HΓ€rkΓΆnen
π»
Kerkko Pelttari
π»
Robocorp
π΅
RenΓ©
π»
Bryan Oakley
π€
Tanakiat Srisaranyakul
π€
Maaret PyhΓ€jΓ€rvi
π
Karlo Smid
π
Frank Schimmel
π
Christoph
β οΈ
Mika HΓ€nninen
π¬
imbus
π΅
Niklas
π
gdroes
β οΈ
Reaktor
π΅
Adrian Yorke
π π
Nanakawa
β οΈ
Ed Manlove
π π
Brian Tsao
π π
charis
π» π
s-galante
π
Simon Meggle
π π β οΈ π€
Anna-Gunda
π
anton264
π
emakaay
π
Nea Ohvo
π
Elout van Leeuwen
π π€ π»
LDerikx
π
olga-
π π
Nicholas Bollweg
π
Ville Salonen
π
Jani Mikkonen
π π π€ π»
Aleh Borysiewicz
π
JΓΌrgen Knauth
π
dalaakso
π
msirkka
π€
Ossi R.
π»
Adrian V.
π» π π€
Sami SallmΓ©n
π β οΈ
Pekka KlΓ€rck
π» π
Jani PalsamΓ€ki
π
AllanMedeiros
π
Emmanuel Alap
π π»
ankurbhalla-gmail
π€
UliSei
π€ π π» π
Tomasz Pawlak
π
mtoskamp
π
zastress
π
Juga Paazmaya
π»
Raphael Smadja
π€ π» π
Antti Pakkanen
π
Luis A Gomez-Tinoco
π π‘ π»
ePlanLori
π
laguna357
π
Gavin Rodgers
π
pokaalinkanssayohon
π€
Ryan Sandbach
π π»
Niko Kahilainen
π
Guillaume Gautier
π
Robin Matz
π€
Stavros Ntentos
π
Massukio
π π€
Atihinen
π
gvrkumar
π€
Lauri Helkkula
π
rlall07
π π€
Eldad Uzman
π€
mgarcibu
π
DominikG
π€
jokinr
β οΈ π
Jier Chen
π»
IDvoe
π
Cosmin Poieana
π
Shenthil
π
Marduk BolaΓ±os
π π€
amodzelewski
π
TimDicos
π
vinismarques
π
nizwiz
π
Reddriver
π€
Seppo
π
rousku
π
tomaspekarovic
π€
Robin Mackaij
π
nixuewei
π€
Slava
π€ π π»
Kari Harju
π
you
π
axiom41
π
amankul
π
jcb-entrnce
π
Remppa
π
Tomasz Pawlak
π
Timo Stordell
π
Marcin Gmurczyk
π»
Daniel Biehl
π π€
rarajabs
π
Sandeep Vaidya
π€
falk
π
ciadoh
π
Johan van Iperen
π»
Fabio Zadrozny
π
BCGST
π
Wilfried van Asten
π π»
Mikal H Henriksen
π
alexinoDr
π
trybuskrzysztof
π
Aino1980
π
BjornAhmark
π
Mezohren
π
Zoupers Zou
π€
lasselindqvist
π
David Nieto Sanz
π
Gil Forcada Codinachs
π π
Nathan Hannig
π
Martin Kjellstrand
π
Anton Medvedev
π»
martamedovova-ext91522
π π€
Dr. Dirk Richter
π€
RatexMak
π€
horzuff
π»
naibra
π
Antti Pekka Vilkko
π
SerafΓn MartΓn
π
JoostW21111
π
Camatius
π
terckert
π
Maksim Bondarew
π
HenrikSchuette
π
Gurunatharudh Bhandarkavathe(Infosys)
π
alpip1997
π
terolindfors
π
Thisara Wijesundera
π€
masudparvez
π€
gitkatsi
π π»
Many Kasiriha
π
Thulasi Raju
π
Giancarlo Soverini
π€
lennartq
π»
Lukas Boekenoogen
π π»
anacomparada
π π
siongwai
π€ π
nfaustin
π
Guido Schmitz
π»
Chris Nesbitt-Smith
π»
vmmattila
π
Andre-A-AtGithub
π
PaweΕ
π
Raphael CAMUS
π
Markus
π€
wojtekwp
π
Rudolf
π π€
Henrique Branco
π
mika-b
π
okraus-ari
π»
ecare-joost
π
PaulBrandUWV
π
ArttuKnowit
π
T. Silvola
π
Teemu Kallio
π
JosΓ© Almeida
π
William Looman
π»
mekxtari
π€
keef78
π€
AndrΓ©
π»
MarvKler
π
Vaclav Carnogursky
π€
Alexander Vey
π
Vaclovas Brazdauskas
π
Benjamin Taylor
π
Rein van der Vegt
π
tomek
π
node137
π
barambulka
π€
timdegroot
π»
Samuel Montgomery-Blinn
π»
Paul Chevallier
π