GitHunt
SN

Snooz82/robotframework-browser

Robot Framework Browser library powered by Playwright.

robotframework-browser

All Contributors

Version
Actions Status
License


Robot Framework Browser library powered by Playwright. Propelling browser automation into the future!

Aiming for ๐Ÿš€ speed, โœ… reliability and ๐Ÿ”ฌ visibility.

See keyword documentation and
web page 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. Documented at docker/README.md.

Install with transformer

Starting from release 18.3.0 Browser library has optional dependency with
Robotidy. Install library with Robotidy, run install with:
pip install robotframework-browser[tidy]. Starting from 18.3.0 release, library will provide external
Robotidy transformer. 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

*** Settings ***
Library   Browser

*** Test Cases ***
Example Test
    New Page    https://playwright.dev
    Get Text    h1    contains    Playwright

and testing with 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

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;
*** Settings ***
Library   Browser  jsextension=${CURDIR}/mymodule.js

*** Test Cases ***
Example Test
   New Page
   myGoToKeyword   https://www.robotframework.org

See example.
Ready made extensions and a place to share your own at robotframework-browser-extensions.

Ergonomic selector syntax, supports chaining of text, css and xpath selectors

# 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

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

# 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

${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

${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 ). This saves some overhead based on how many splits of tests you are running. Clean up the process afterwards.

Re-using authentication credentials

Development

See 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 through Robot Framework Foundation.

Mikko Korpela
Mikko Korpela

๐Ÿ’ป
Tatu Aalto
Tatu Aalto

๐Ÿ’ป
Antti Karjalainen
Antti Karjalainen

๐Ÿ”
Ismo Aro
Ismo Aro

๐Ÿ”
Janne Hรคrkรถnen
Janne Hรคrkรถnen

๐Ÿ’ป
Kerkko Pelttari
Kerkko Pelttari

๐Ÿ’ป
Robocorp
Robocorp

๐Ÿ’ต
Renรฉ
Renรฉ

๐Ÿ’ป
Bryan Oakley
Bryan Oakley

๐Ÿค”
Tanakiat Srisaranyakul
Tanakiat Srisaranyakul

๐Ÿค”
Maaret Pyhรคjรคrvi
Maaret Pyhรคjรคrvi

๐Ÿ““
Karlo Smid
Karlo Smid

๐Ÿ““
Frank Schimmel
Frank Schimmel

๐Ÿ““
Christoph
Christoph

โš ๏ธ
Mika Hรคnninen
Mika Hรคnninen

๐Ÿ’ฌ
imbus
imbus

๐Ÿ’ต
Niklas
Niklas

๐Ÿ“–
gdroes
gdroes

โš ๏ธ
Reaktor
Reaktor

๐Ÿ’ต
Adrian Yorke
Adrian Yorke

๐Ÿ“– ๐Ÿ‘€
Nanakawa
Nanakawa

โš ๏ธ
Ed Manlove
Ed Manlove

๐Ÿ“– ๐Ÿ›
Brian Tsao
Brian Tsao

๐Ÿ› ๐Ÿ““
charis
charis

๐Ÿ’ป ๐Ÿ›
s-galante
s-galante

๐Ÿ›
Simon Meggle
Simon Meggle

๐Ÿ““ ๐Ÿ› โš ๏ธ ๐Ÿค”
Anna-Gunda
Anna-Gunda

๐Ÿ›
anton264
anton264

๐Ÿ““
emakaay
emakaay

๐Ÿ›
Nea Ohvo
Nea Ohvo

๐Ÿ›
Elout van Leeuwen
Elout van Leeuwen

๐Ÿ“– ๐Ÿค” ๐Ÿ’ป
LDerikx
LDerikx

๐Ÿ“–
olga-
olga-

๐Ÿ“– ๐Ÿ›
Nicholas Bollweg
Nicholas Bollweg

๐Ÿ“–
Ville Salonen
Ville Salonen

๐Ÿ›
Jani Mikkonen
Jani Mikkonen

๐Ÿ› ๐Ÿ“– ๐Ÿค” ๐Ÿ’ป
Aleh Borysiewicz
Aleh Borysiewicz

๐Ÿ›
Jรผrgen Knauth
Jรผrgen Knauth

๐Ÿ›
dalaakso
dalaakso

๐Ÿ›
msirkka
msirkka

๐Ÿค”
Ossi R.
Ossi R.

๐Ÿ’ป
Adrian V.
Adrian V.

๐Ÿ’ป ๐Ÿ› ๐Ÿค”
Sami Sallmรฉn
Sami Sallmรฉn

๐Ÿ› โš ๏ธ
Pekka Klรคrck
Pekka Klรคrck

๐Ÿ’ป ๐Ÿ›
Jani Palsamรคki
Jani Palsamรคki

๐Ÿ›
AllanMedeiros
AllanMedeiros

๐Ÿ›
Emmanuel Alap
Emmanuel Alap

๐Ÿ› ๐Ÿ’ป
ankurbhalla-gmail
ankurbhalla-gmail

๐Ÿค”
UliSei
UliSei

๐Ÿค” ๐Ÿ› ๐Ÿ’ป ๐Ÿ““
Tomasz Pawlak
Tomasz Pawlak

๐Ÿ›
mtoskamp
mtoskamp

๐Ÿ›
zastress
zastress

๐Ÿ›
Juga Paazmaya
Juga Paazmaya

๐Ÿ’ป
Raphael Smadja
Raphael Smadja

๐Ÿค” ๐Ÿ’ป ๐Ÿ›
Antti Pakkanen
Antti Pakkanen

๐Ÿ›
Luis A Gomez-Tinoco
Luis A Gomez-Tinoco

๐Ÿ› ๐Ÿ’ก ๐Ÿ’ป
ePlanLori
ePlanLori

๐Ÿ›
laguna357
laguna357

๐Ÿ›
Gavin Rodgers
Gavin Rodgers

๐Ÿ›
pokaalinkanssayohon
pokaalinkanssayohon

๐Ÿค”
Ryan Sandbach
Ryan Sandbach

๐Ÿ› ๐Ÿ’ป
Niko Kahilainen
Niko Kahilainen

๐Ÿ›
Guillaume Gautier
Guillaume Gautier

๐Ÿ“–
Robin Matz
Robin Matz

๐Ÿค”
Stavros Ntentos
Stavros Ntentos

๐Ÿ“–
Massukio
Massukio

๐Ÿ› ๐Ÿค”
Atihinen
Atihinen

๐Ÿ›
gvrkumar
gvrkumar

๐Ÿค”
Lauri Helkkula
Lauri Helkkula

๐Ÿ›
rlall07
rlall07

๐Ÿ› ๐Ÿค”
Eldad Uzman
Eldad Uzman

๐Ÿค”
mgarcibu
mgarcibu

๐Ÿ›
DominikG
DominikG

๐Ÿค”
jokinr
jokinr

โš ๏ธ ๐Ÿ›
Jier Chen
Jier Chen

๐Ÿ’ป
IDvoe
IDvoe

๐Ÿ›
Cosmin Poieana
Cosmin Poieana

๐Ÿ›
Shenthil
Shenthil

๐Ÿ›
Marduk Bolaรฑos
Marduk Bolaรฑos

๐Ÿ› ๐Ÿค”
amodzelewski
amodzelewski

๐Ÿ›
TimDicos
TimDicos

๐Ÿ›
vinismarques
vinismarques

๐Ÿ›
nizwiz
nizwiz

๐Ÿ›
Reddriver
Reddriver

๐Ÿค”
Seppo
Seppo

๐Ÿ›
rousku
rousku

๐Ÿ›
tomaspekarovic
tomaspekarovic

๐Ÿค”
Robin Mackaij
Robin Mackaij

๐Ÿ›
nixuewei
nixuewei

๐Ÿค”
Slava
Slava

๐Ÿค” ๐Ÿ› ๐Ÿ’ป
Kari Harju
Kari Harju

๐Ÿ›
you
you

๐Ÿ›
axiom41
axiom41

๐Ÿ›
amankul
amankul

๐Ÿ›
jcb-entrnce
jcb-entrnce

๐Ÿ›
Remppa
Remppa

๐Ÿ›
Tomasz Pawlak
Tomasz Pawlak

๐Ÿ›
Timo Stordell
Timo Stordell

๐Ÿ›
Marcin Gmurczyk
Marcin Gmurczyk

๐Ÿ’ป
Daniel Biehl
Daniel Biehl

๐Ÿ› ๐Ÿค”
rarajabs
rarajabs

๐Ÿ›
Sandeep Vaidya
Sandeep Vaidya

๐Ÿค”
falk
falk

๐Ÿ“–
ciadoh
ciadoh

๐Ÿ›
Johan van Iperen
Johan van Iperen

๐Ÿ’ป
Fabio Zadrozny
Fabio Zadrozny

๐Ÿ›
BCGST
BCGST

๐Ÿ“–
Wilfried van Asten
Wilfried van Asten

๐Ÿ› ๐Ÿ’ป
Mikal H Henriksen
Mikal H Henriksen

๐Ÿ›
alexinoDr
alexinoDr

๐Ÿ›
trybuskrzysztof
trybuskrzysztof

๐Ÿ›
Aino1980
Aino1980

๐Ÿ›
BjornAhmark
BjornAhmark

๐Ÿ›
Mezohren
Mezohren

๐Ÿ›
Zoupers Zou
Zoupers Zou

๐Ÿค”
lasselindqvist
lasselindqvist

๐Ÿ›
David Nieto Sanz
David Nieto Sanz

๐Ÿ›
Gil Forcada Codinachs
Gil Forcada Codinachs

๐Ÿ“– ๐Ÿ›
Nathan Hannig
Nathan Hannig

๐Ÿ›
Martin Kjellstrand
Martin Kjellstrand

๐Ÿ›
Anton Medvedev
Anton Medvedev

๐Ÿ’ป
martamedovova-ext91522
martamedovova-ext91522

๐Ÿ› ๐Ÿค”
Dr. Dirk Richter
Dr. Dirk Richter

๐Ÿค”
RatexMak
RatexMak

๐Ÿค”
horzuff
horzuff

๐Ÿ’ป
naibra
naibra

๐Ÿ›
Antti Pekka Vilkko
Antti Pekka Vilkko

๐Ÿ›
Serafรญn Martรญn
Serafรญn Martรญn

๐Ÿ›
JoostW21111
JoostW21111

๐Ÿ›
Camatius
Camatius

๐Ÿ›
terckert
terckert

๐Ÿ›
Maksim Bondarew
Maksim Bondarew

๐Ÿ›
HenrikSchuette
HenrikSchuette

๐Ÿ›
Gurunatharudh Bhandarkavathe(Infosys)
Gurunatharudh Bhandarkavathe(Infosys)

๐Ÿ›
alpip1997
alpip1997

๐Ÿ›
terolindfors
terolindfors

๐Ÿ›
Thisara Wijesundera
Thisara Wijesundera

๐Ÿค”
masudparvez
masudparvez

๐Ÿค”
gitkatsi
gitkatsi

๐Ÿ› ๐Ÿ’ป
Many Kasiriha
Many Kasiriha

๐Ÿ›
Thulasi Raju
Thulasi Raju

๐Ÿ“–
Giancarlo Soverini
Giancarlo Soverini

๐Ÿค”
lennartq
lennartq

๐Ÿ’ป
Lukas Boekenoogen
Lukas Boekenoogen

๐Ÿ“– ๐Ÿ’ป
anacomparada
anacomparada

๐Ÿ› ๐Ÿ“–
siongwai
siongwai

๐Ÿค” ๐Ÿ›
nfaustin
nfaustin

๐Ÿ›
Guido Schmitz
Guido Schmitz

๐Ÿ’ป
Chris Nesbitt-Smith
Chris Nesbitt-Smith

๐Ÿ’ป
vmmattila
vmmattila

๐Ÿ›
Andre-A-AtGithub
Andre-A-AtGithub

๐Ÿ›
Paweล‚
Paweล‚

๐Ÿ›
Raphael CAMUS
Raphael CAMUS

๐Ÿ›
Markus
Markus

๐Ÿค”
wojtekwp
wojtekwp

๐Ÿ›
Rudolf
Rudolf

๐Ÿ› ๐Ÿค”
Henrique Branco
Henrique Branco

๐Ÿ›
mika-b
mika-b

๐Ÿ›
okraus-ari
okraus-ari

๐Ÿ’ป
ecare-joost
ecare-joost

๐Ÿ›
PaulBrandUWV
PaulBrandUWV

๐Ÿ›
ArttuKnowit
ArttuKnowit

๐Ÿ›
T. Silvola
T. Silvola

๐Ÿ›
Teemu Kallio
Teemu Kallio

๐Ÿ›
Josรฉ Almeida
Josรฉ Almeida

๐Ÿ›
William Looman
William Looman

๐Ÿ’ป
mekxtari
mekxtari

๐Ÿค”
keef78
keef78

๐Ÿค”
Andrรฉ
Andrรฉ

๐Ÿ’ป
MarvKler
MarvKler

๐Ÿ›
Vaclav Carnogursky
Vaclav Carnogursky

๐Ÿค”
Alexander Vey
Alexander Vey

๐Ÿ›
Vaclovas Brazdauskas
Vaclovas Brazdauskas

๐Ÿ›
Benjamin Taylor
Benjamin Taylor

๐Ÿ›
Rein van der Vegt
Rein van der Vegt

๐Ÿ›
tomek
tomek

๐Ÿ›