Skip to main content

Write responsive web apps in full python

Project description

virtual-cursor

license MIT Python Version Latest Version

virtual-cursor adds human-like cursor animations to your browser tests.

Browser test libraries like Selenium or Playwright can be used to generate screenshots or videos of websites, which are great for debugging or as media for documentation. Most of the times, these videos are not very useful, because the test code clicks much faster than a human and the cursor is invisible.

virtual-cursor emulates a cursor by injecting a custom JavaScript payload into the test browser, which animates a mocked, second cursor, and adds delays to slow down the test code.

Gallery

Installation

virtual-cursor can be installed via pip

pip install virtual-cursor

Usage

pytest + playwright

See a full example which produces the clip above.

async def test_virtual_cursor():
    from playwright.async_api import async_playwright

    from virtual_cursor.playwright import click, fill, check, selectOption

    async with async_playwright() as playwright:
        browser = await playwright.chromium.launch()

        browser_context = await browser.new_context(
            record_video_dir='/tmp/videos/',
        )

        page = await browser_context.new_page()
        await page.goto('http://localhost')

        # click element
        await click(page, '#button')

        # fill out a text-input
        await fill(page, '#text-input', 'Lorem Ipsum')

        # select an option of a select
        await selectOption(page, '#select', 'Option 17')

        # check a checkbox
        await check(page, '#check-box')

Project details


Release history Release notifications | RSS feed

This version

0.1

Download files

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

Source Distribution

virtual-cursor-0.1.tar.gz (8.6 kB view details)

Uploaded Source

Built Distribution

virtual_cursor-0.1-py3-none-any.whl (7.9 kB view details)

Uploaded Python 3

File details

Details for the file virtual-cursor-0.1.tar.gz.

File metadata

  • Download URL: virtual-cursor-0.1.tar.gz
  • Upload date:
  • Size: 8.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for virtual-cursor-0.1.tar.gz
Algorithm Hash digest
SHA256 7be3d5d243ceff3a3c61f5ef1f1bee0da01245c53c5505a88662511191be9fcc
MD5 331cb2b196456d78db2ccd089d7c10ed
BLAKE2b-256 f2a517b51e579534e0aea4d166714a25d6b6138120c6a2649794896176159c64

See more details on using hashes here.

File details

Details for the file virtual_cursor-0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for virtual_cursor-0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 493a4cf851a2d31f3c17bd3ef837153ab5223eb01cecc59de708fdd2733ace82
MD5 b2bae9369988338e0f103c9ce5cd7a45
BLAKE2b-256 0bfda95cd4f807660f64bee0ecf4731acd136d387f493e8839cbfe3707488e92

See more details on using hashes here.

Supported by

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