Skip to main content

Plain English web test automation using Selenium and Playwright. No code. No maintenance.

Project description

snakeoil-web

PyPI version Python 3.8+ License: MIT

Dependencies

  • Python 3.8+
  • A supported browser installed on your machine (Chrome, Firefox, Safari, or Edge)

Everything else — Playwright, pytest, pytest-html — is installed automatically by snakeoil init.


Install

pip install snakeoil-web

Quick start

pip install snakeoil-web
snakeoil init
pytest web-tests/

snakeoil init creates your project structure, installs pytest and pytest-html, installs browser binaries, and generates sample tests ready to run.


What snakeoil init creates

your-project/
├── snakeoil.web.config.py   ← configure URL, browser, headless mode
├── pytest.ini               ← pytest settings
└── web-tests/
    ├── test_english.py      ← English instruction style tests
    └── test_pythonic.py     ← Pythonic API style tests

After running your tests:

your-project/
└── report.html              ← test report (open in browser)

Configuration

Edit snakeoil.web.config.py in your project root to point at your site and set your preferences:

# URL of the site under test
URL = "https://yourapp.com"

# Browser to use: chrome | firefox | safari | edge
# chrome  — Google Chrome (must be installed)
# firefox — Mozilla Firefox (must be installed)
# safari  — Safari via WebKit (macOS only)
# edge    — Microsoft Edge (must be installed)
BROWSER = "chrome"

# Run browser without a visible window (True for CI, False for local debugging)
HEADLESS = False

# Launch browser maximized (ignored when HEADLESS = True)
MAXIMIZED = True

# Maximum time in milliseconds to wait for elements and page loads
TIMEOUT = 10_000

# Directory where report.html is saved after each test run
RESULT_DIR = "test_report"

# Capture a screenshot when a step fails and embed it in the report
SCREENSHOTS_ON_FAILURE = False

Two ways to write tests

English — human readable, shareable with non-developers:

def test_login(agent):
    agent.run([
        'type "harish@example.com" into "Email"',
        'type "secret123" into "Password"',
        'click "Sign in"',
        'verify text "Dashboard" is present',
    ])

Pythonic — IDE guided, autocomplete friendly:

def test_login(agent):
    (agent
        .type("harish@example.com", into="Email")
        .type("secret123", into="Password")
        .click("Sign in")
        .verify_text("Dashboard")
    )

Supported instructions

Actions

Instruction Example
Type into a field type "value" into "Field Label"
Click an element click "Button Text"
Click by position click "Add to cart" below "Product Name"
Click near element click "Edit" near "John Smith"
Click nth element click second "Add to cart"
Select a dropdown select "Option" from "dropdown_name"
Hover over element hover "element"
Press a key press Enter
Navigate to URL navigate "https://yourapp.com/page"

Verification

Instruction Example
Verify text is present verify text "Welcome" is present
Verify element is present verify "Submit" is present
Verify element is visible verify "Submit" is visible
Verify text next to element verify text next to "Balance" is "$100.00"
Verify text below element verify text below "Total" is "$29.99"

Extraction

Instruction Example
Extract from element extract text from "element_class"
Extract nth extract text from first "item name"
Extract next to element extract text next to "Balance"
Extract near element extract text near "Balance"
Extract below element extract text below "Label"
Extract above element extract text above "Label"
Capture into variable {{price}} = extract text next to "Total"

Spatial targeting

Use element position when there's no unique visible text:

# Pythonic
agent.click("Add to cart", below="Sauce Labs Backpack")
agent.click("Edit", next_to="John Smith")
agent.extract_text(next_to="Balance")

# English
agent.run('click "Add to cart" below "Sauce Labs Backpack"')
agent.run('extract text next to "Balance"')

Supported directions: next to, below, above, left of, right of, near


Extracting values

# Direct return
price = agent.run('extract text next to "Total"')
assert price == "$29.99"

# Variable capture inside run()
agent.run('{{balance}} = extract text next to "Balance"')
balance = agent.get("balance")

# Pythonic
price = agent.extract_text(next_to="Total")

Using variables in tests

username = "standard_user"
password = "secret_sauce"

def test_login(agent):
    agent.run([
        f'type "{username}" into "Username"',   # f-strings for Python variables
        f'type "{password}" into "Password"',
        'click "Login"',
        'verify text "Products" is present',
    ])

Running tests

# Run all tests
pytest web-tests/

# Run a single test
pytest web-tests/test_english.py::test_login

# Run headless (no browser window)
HEADLESS=True pytest web-tests/

# View the report
open report.html

Supported browsers

Config value Browser
chrome Google Chrome
firefox Mozilla Firefox
safari Safari (macOS only)
edge Microsoft Edge

Chrome, Firefox, and Edge must be installed on your machine. Safari is available on macOS without additional installation.

PyPI

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

snakeoil_web-0.1.42-cp312-cp312-win_amd64.whl (1.7 MB view details)

Uploaded CPython 3.12Windows x86-64

snakeoil_web-0.1.42-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.1 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

snakeoil_web-0.1.42-cp312-cp312-macosx_11_0_arm64.whl (1.8 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

snakeoil_web-0.1.42-cp311-cp311-win_amd64.whl (1.7 MB view details)

Uploaded CPython 3.11Windows x86-64

snakeoil_web-0.1.42-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.1 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

snakeoil_web-0.1.42-cp311-cp311-macosx_11_0_arm64.whl (1.8 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

snakeoil_web-0.1.42-cp310-cp310-win_amd64.whl (1.7 MB view details)

Uploaded CPython 3.10Windows x86-64

snakeoil_web-0.1.42-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.0 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

snakeoil_web-0.1.42-cp310-cp310-macosx_11_0_arm64.whl (1.8 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

snakeoil_web-0.1.42-cp39-cp39-win_amd64.whl (1.7 MB view details)

Uploaded CPython 3.9Windows x86-64

snakeoil_web-0.1.42-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.9 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

snakeoil_web-0.1.42-cp39-cp39-macosx_11_0_arm64.whl (1.8 MB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

File details

Details for the file snakeoil_web-0.1.42-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for snakeoil_web-0.1.42-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 bb996b9bc03d9fd9468477fb3b74743ecaf24d64e26d34009de4ca9087f2fe63
MD5 a57505f72864cbec3a078fcf4f700963
BLAKE2b-256 61e907a810120fd76e7fece996d06a18ffc29c472c0ddd1656646f29c65688ff

See more details on using hashes here.

Provenance

The following attestation bundles were made for snakeoil_web-0.1.42-cp312-cp312-win_amd64.whl:

Publisher: publish.yml on snakeoiltool/snakeoil-web

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file snakeoil_web-0.1.42-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for snakeoil_web-0.1.42-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3c4be5a94aded285cd286d5a62cb160484912895b8398b17e6e5d8a7cba0ddda
MD5 c30daf1bc674f35a80b6538951e85a5e
BLAKE2b-256 c84e641682d3d7fd2c7d6445ce6569016992b61913f6c0962105638efeab5bbc

See more details on using hashes here.

Provenance

The following attestation bundles were made for snakeoil_web-0.1.42-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: publish.yml on snakeoiltool/snakeoil-web

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file snakeoil_web-0.1.42-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for snakeoil_web-0.1.42-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7db3317a92a25a6e07a64a152c63b2c68c2922e9ab04155d490a264eec737f8b
MD5 608a5ed8f7be675101bc01a462a7b440
BLAKE2b-256 e4e632a484ad88ed357650db68da24657363284c4e36a28530e203bb861c4c55

See more details on using hashes here.

Provenance

The following attestation bundles were made for snakeoil_web-0.1.42-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: publish.yml on snakeoiltool/snakeoil-web

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file snakeoil_web-0.1.42-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for snakeoil_web-0.1.42-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 2a1d22f26bc440a65abfc51fa8a734a81c28f4a59a08c56742c9128d3182892c
MD5 82c986bdb89c8949b518273829723597
BLAKE2b-256 34abb7d9e34e389a7f7a419f2a3fbc063be925ed8d7bea3a978ccd32e143d852

See more details on using hashes here.

Provenance

The following attestation bundles were made for snakeoil_web-0.1.42-cp311-cp311-win_amd64.whl:

Publisher: publish.yml on snakeoiltool/snakeoil-web

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file snakeoil_web-0.1.42-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for snakeoil_web-0.1.42-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 47a1cd71e02713528ac9d5b6c9ff692fdc677fd82f545e4e0bdb923cbcd45ff8
MD5 8169dac0f07b14e26fa67f7847c38fb7
BLAKE2b-256 59329bdd6a4e171ee8a74f256143cdb8c1504ff4926a2fdb611e30e1e0c380f6

See more details on using hashes here.

Provenance

The following attestation bundles were made for snakeoil_web-0.1.42-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: publish.yml on snakeoiltool/snakeoil-web

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file snakeoil_web-0.1.42-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for snakeoil_web-0.1.42-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 507198b51a44e52b349f7d8da1f458b9b584243f7e7039c3c51382ba2b27a753
MD5 a5b9bd142aaa2469a69cc52a48a6d3ac
BLAKE2b-256 2da56ff86c00f275986413a5a8605f4c80a8b99f3e1c2b2f820e49724cba22a0

See more details on using hashes here.

Provenance

The following attestation bundles were made for snakeoil_web-0.1.42-cp311-cp311-macosx_11_0_arm64.whl:

Publisher: publish.yml on snakeoiltool/snakeoil-web

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file snakeoil_web-0.1.42-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for snakeoil_web-0.1.42-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 4999d763f64b038997a2ec23fe81b2577d0c56e49ac9d63215e75f8e283b79a0
MD5 b5d56574c75685b8aa70e3836c613266
BLAKE2b-256 36dc35f9836163faaf3be265048cd71953e8ebdaa9dd1830e929555b1d8aeab6

See more details on using hashes here.

Provenance

The following attestation bundles were made for snakeoil_web-0.1.42-cp310-cp310-win_amd64.whl:

Publisher: publish.yml on snakeoiltool/snakeoil-web

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file snakeoil_web-0.1.42-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for snakeoil_web-0.1.42-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 62e8762663446c8282d4cc6967ab329a3ccb68ac25c477f2dbaa6f87c5b67609
MD5 dfc539218b556b988ce1cf51f6e28f66
BLAKE2b-256 6341483e83813758737bf5183aa3bdd7f406ae1891e02212589a76b582f0f6e5

See more details on using hashes here.

Provenance

The following attestation bundles were made for snakeoil_web-0.1.42-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: publish.yml on snakeoiltool/snakeoil-web

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file snakeoil_web-0.1.42-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for snakeoil_web-0.1.42-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 68d0af777622245d725d9d0e9588efa2931fbdf42e063ddd1f396f9ee94d817b
MD5 fe55f116d2b9e79ff7b621108fe46a41
BLAKE2b-256 91c467be93fa8e47f3b460b28c87b5bb0937b5944a7c2748d5ed80f0659a1cfd

See more details on using hashes here.

Provenance

The following attestation bundles were made for snakeoil_web-0.1.42-cp310-cp310-macosx_11_0_arm64.whl:

Publisher: publish.yml on snakeoiltool/snakeoil-web

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file snakeoil_web-0.1.42-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for snakeoil_web-0.1.42-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 d194702134f17657dbdbb76923f4c520e1c28bc505a4a379367486c964141ef8
MD5 049f70178d1f49879354f0bc99f74f46
BLAKE2b-256 fc3238bdb7329817627890c0a5ab6a199544e4b9d232c05b4cc98e3d8eb4dd42

See more details on using hashes here.

Provenance

The following attestation bundles were made for snakeoil_web-0.1.42-cp39-cp39-win_amd64.whl:

Publisher: publish.yml on snakeoiltool/snakeoil-web

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file snakeoil_web-0.1.42-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for snakeoil_web-0.1.42-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 82e642c1a424a73ec8807ebc862f60ba3c65d27cd4ed342f13bdd965cf59ec0e
MD5 3246e003e5668a499980dedb3e7f25da
BLAKE2b-256 75b09e602186bff3ceb5017cbb8f8ea6137d731e4744cb1d46c676ab9821295b

See more details on using hashes here.

Provenance

The following attestation bundles were made for snakeoil_web-0.1.42-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: publish.yml on snakeoiltool/snakeoil-web

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file snakeoil_web-0.1.42-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for snakeoil_web-0.1.42-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e190d4521a9465db841d339ecd63d692e9b4d0aefe3aec16f25818b43e8b745e
MD5 e2ed4d70f2b4f2e6534118f3970952a5
BLAKE2b-256 1b30aa3e64df24962f9ca32ba18736eff541bd33e68d5bd71a79fc7253fb9b9c

See more details on using hashes here.

Provenance

The following attestation bundles were made for snakeoil_web-0.1.42-cp39-cp39-macosx_11_0_arm64.whl:

Publisher: publish.yml on snakeoiltool/snakeoil-web

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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