Skip to main content

An extension for recording and playback of web interactions in Playwright

Project description

Recordwright PyPI version

An extension for recording and playback of web interactions in Playwright.

While other interaction recorders generate code that you have to extend with your tests, Recordwright integrates the interactions into your test. The first time you run the test, the interaction is recorded, and the following time the recording is played back. If the interaction changes it can be simply recorded again. You do not need to rewrite the whole test.

Recordwright records every event and can also play back drag and drop operations.

Installation

To install Recordwright

pip install recordwright

Usage

The following example demonstates the usage of Recordwright

from playwright.sync_api import sync_playwright
from recordwright import install as install_recorder  # import Recordwright

if __name__ == "__main__":
    with sync_playwright() as p:
        browser = p.chromium.launch(headless=False)
        page = browser.new_page()
        page.goto("https://demo.playwright.dev/todomvc")

        page.get_by_placeholder("What needs to be done?").wait_for()

        # injects the recording code into the page
        recorder = install_recorder(page)

        # if there is no replay file "todo.json, the recording is started and 
        # the result is stored in a replay file.
        # Otherwise the replay file will be replayed.
        recorder.interaction("todo", """
        - Click "What needs to be done"
        - Type "Test RecordWright"
        - Press Enter
        """)

        lis = page.get_by_test_id("todo-item")
        item = lis.first
        assert(item.inner_text() == "Test RecordWright")

        browser.close()

Project details


Download files

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

Source Distribution

recordwright-1.0.1.tar.gz (43.8 kB view details)

Uploaded Source

Built Distribution

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

recordwright-1.0.1-py3-none-any.whl (43.8 kB view details)

Uploaded Python 3

File details

Details for the file recordwright-1.0.1.tar.gz.

File metadata

  • Download URL: recordwright-1.0.1.tar.gz
  • Upload date:
  • Size: 43.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for recordwright-1.0.1.tar.gz
Algorithm Hash digest
SHA256 6c815165f429386ebbe941402263fbe51d6cd75fe9a22be16673f4f7233d169f
MD5 bf7bb3b763a563a16118540c22d3ab00
BLAKE2b-256 23ea2bd2c2f4acf45e63e1e4f6f79d1c57a0efde08d359534ddd05061b7261ce

See more details on using hashes here.

File details

Details for the file recordwright-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: recordwright-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 43.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for recordwright-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 31920d5429e56e8e478f712e22d93df8decf4b0b4595314ac4e4038924377e01
MD5 375687db05ace1b2dcef29100acc434e
BLAKE2b-256 afb68060ce6b8ee7d00b75fc793b29e8f5ba91da8f0c47fbd5e4e8e8de6e27d5

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