Skip to main content

No project description provided

Project description

robotframework-browser

All Contributors

Version Actions Status License


:construction_worker: :construction: Work in Progress :construction: :performing_arts:

Robot Framework Browser library powered by Playwright. Moving browser automation to year 2020 (or 2021)!

Aiming for :rocket: speed, :white_check_mark: reliability and :microscope: visibility.

Supporting testing and automation with Robot Framework

*** Settings ***
Library   Browser

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

and Python.

import Browser
browser = Browser.Browser()
browser.new_page("https://playwright.dev")
assert browser.get_text("h1") == '🎭 Playwright'
browser.close_all_browsers()

Official post about this venture.

See keyword documentation.

Installation instructions

Only Python 3.8 or later is supported.

  1. Install node.js e.g. from https://nodejs.org/en/download/
  2. Install robotframework-browser from the commandline: pip install robotframework-browser

Development

Source code organization

These are the directories containing source code and tests:

  • Browser, contains the Python source code for the actual Robot Framework test library.
  • node/playwright-wrapper, contains a wrapper for Playwirght that implements the grpc protocol, implemented in Typescript.
  • node/dynamic-test-app, contains a test application used in the acceptance tests, implemented in Typescript + React.
  • protobuf, contains the Protocol Buffer definitions used by the communication between the library and Playwirght wrapper.
  • utest, unit tests for the Python code.
  • atest, acceptance tests written with Robot Framework.

Development environment

Install Python, nodejs and yarn. Make sure you have make available.

Setup development environment with make dev-env. This creates a Python virtualenv in .venv directory, and install both Python and nodejs dependencies.

To update the dependencies use either make dev-env to update all or alternatively make .venv or make node-deps to update only Python or nodejs dependencies, respectively.

Make sure to run source .venv/bin/activate to activate the correct virtualenv.

Run make build or yarn build to build the Typescript code. Also run make build after changes to the protocol (protos/playwright.proto) to re-generate protobuffer code.

Development in Windows

Install Chocolatey and then install development tools with choco install sed make.

After that, the development workflow should work as described in the previous chapter. The only difference is that the virtualenv needs to be activated by running .venv\Scripts\activate in the command prompt.

Testing

There are both unit tests written with pytest and acceptance test written with Robot Framework. These can be run manually with make utest and make atest. To run continuously pytests in a watch mode make utest-watch. To rerun failed tests you can use make test-failed The tests are also executed in a prepush hook.

Running tests in docker container

Docker container builds a clean install package. This can be used to check that a builded package works correctly in a clean environment without development dependencies.

  1. Build the container make docker
  2. Run tests mounted from host machine make docker-test.
  3. See results in atest/output

Releasing

  1. Ensure generated code and types are up to date with make build
  2. Ensure tests and linting pass on CI
  3. Check that you have permissions to release on Github and PyPi
  4. Run make version VERSION=<new_version> to update the version information to both Python and Node components.
  5. Use make release to create and release artifacts and upload to PyPi
  6. Create Github release

Code style

Python code style is enforced with flake8 and black. These are executed in a precommit hook, but can also be invoked manually with make lint-python.

JS / TS code style is enforced with eslint. Lints are run in precommit hooks, but can be run manually with make lint-node.

Architecture

There are 3 different interfaces that the library is targeting to use in browser automation and testing:

  1. User interface: Interactions with DOM elements.
  2. Internals of a webapp: State, Cookies, Storage, Methods.
  3. Requests & Responses: Interface between a browser and servers .

Python Library <--> gRPC <---> TypeScript and Playwright

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

💻

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

📓

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

robotframework-browser-0.11.0.tar.gz (575.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

robotframework_browser-0.11.0-py3-none-any.whl (606.8 kB view details)

Uploaded Python 3

File details

Details for the file robotframework-browser-0.11.0.tar.gz.

File metadata

  • Download URL: robotframework-browser-0.11.0.tar.gz
  • Upload date:
  • Size: 575.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.5

File hashes

Hashes for robotframework-browser-0.11.0.tar.gz
Algorithm Hash digest
SHA256 52ebb980d8753531cfb79a81952e9135a4cf73c32bc58e7b6970a6cee16e8699
MD5 4f9c448ba635030fd0ae53b19c04bd5e
BLAKE2b-256 263a470228ef3637c44662e6ff2e54d11a9ed171b3c1a9948b2783801d72d729

See more details on using hashes here.

File details

Details for the file robotframework_browser-0.11.0-py3-none-any.whl.

File metadata

  • Download URL: robotframework_browser-0.11.0-py3-none-any.whl
  • Upload date:
  • Size: 606.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.5

File hashes

Hashes for robotframework_browser-0.11.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b5fd44fa5059e36b70d07aafa31e0bb66dffebbe25e80be608fab07dabc0b83c
MD5 610b72298ea4d726d576410ecc306529
BLAKE2b-256 6c8a69e24214d3373019efa91b66f5668ddeb6057f58a5fa4d9e78d42315e7a5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page