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 = 30_000

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

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.28-cp312-cp312-win_amd64.whl (1.7 MB view details)

Uploaded CPython 3.12Windows x86-64

snakeoil_web-0.1.28-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

snakeoil_web-0.1.28-cp312-cp312-macosx_11_0_arm64.whl (1.7 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

snakeoil_web-0.1.28-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.9 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

snakeoil_web-0.1.28-cp311-cp311-macosx_11_0_arm64.whl (1.7 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

snakeoil_web-0.1.28-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.6 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

snakeoil_web-0.1.28-cp310-cp310-macosx_11_0_arm64.whl (1.7 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

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

Uploaded CPython 3.9Windows x86-64

snakeoil_web-0.1.28-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.6 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

snakeoil_web-0.1.28-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.28-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for snakeoil_web-0.1.28-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 48a714c36a0c0f8bae1d5bd095c2b50d9c4eedcf1f2c84c0e7d74f1a5f845df8
MD5 f20f083b769839aba54cafd2ac018a7c
BLAKE2b-256 00c92b3bd66b28fa8d3508b0614cd72b4a2b75dc891168b71687cbd1015b97dd

See more details on using hashes here.

Provenance

The following attestation bundles were made for snakeoil_web-0.1.28-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.28-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for snakeoil_web-0.1.28-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 54383e84cd349c1dc73bba9546c3e348284f621a839816b0d662d8134fa12ea4
MD5 c9ce7d7b207c6e761ea4927b18178191
BLAKE2b-256 e925fe0e61917ef00e1cde6d8dbd3a4646a6d3af7ce3b8e8f2a13f122d4913a5

See more details on using hashes here.

Provenance

The following attestation bundles were made for snakeoil_web-0.1.28-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.28-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for snakeoil_web-0.1.28-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5ae9519a3ca2a9b328a1345cc5b6a3dc8a9451d7aed9692d92a4bc26f6f8d9d9
MD5 f49482d93d05a2dbdc72cf89026b816d
BLAKE2b-256 1cdb775402b16987163f032e6712d5416a1dec661f6369cb5a3e605f8d934d79

See more details on using hashes here.

Provenance

The following attestation bundles were made for snakeoil_web-0.1.28-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.28-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for snakeoil_web-0.1.28-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 ad773c556050a0f5abd1a87b9308ea06b4c1186c3325fd711144ad53bbf227a9
MD5 b12fc8fde827b358468858321f3207a0
BLAKE2b-256 21f3097fc125dae6942e669bf3378149f1ebfd9eaaed40472805627b41f20343

See more details on using hashes here.

Provenance

The following attestation bundles were made for snakeoil_web-0.1.28-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.28-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for snakeoil_web-0.1.28-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c75ad63a933935e5473bf7a8e931f3a9661714ef573dcd9addc8dc0cfbb4c2dd
MD5 2493b86ccaf62a2b27e95653d46da8f1
BLAKE2b-256 c14252a003d7265b06fdb48362c9c055122cad95725c1475487fa50f6ae17dd8

See more details on using hashes here.

Provenance

The following attestation bundles were made for snakeoil_web-0.1.28-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.28-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for snakeoil_web-0.1.28-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2465b93316c9fdb532d91fdd1cce400f11d4b39000c3c57c3bcdb18dbf5e2dd8
MD5 055870ef9df15b3fb702755c214425f5
BLAKE2b-256 296044466d00cba1d25cc8524d7e05ecdad122015b3656e80a577ad156fad494

See more details on using hashes here.

Provenance

The following attestation bundles were made for snakeoil_web-0.1.28-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.28-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for snakeoil_web-0.1.28-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 d7f271edfa351e63dfe3905b9a147514b0ccbd15bb414245fb44d0828f1fb1ce
MD5 d021bbc159f1b2c63822f5266b19e933
BLAKE2b-256 8df097f21821b98c5269257334295c9a93bee539f02a980c1f3522fbda0fe0e9

See more details on using hashes here.

Provenance

The following attestation bundles were made for snakeoil_web-0.1.28-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.28-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for snakeoil_web-0.1.28-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 6cded6311dcaee46f9f7af51462c32008e731b89756e68cc7f8967256cddd291
MD5 22c008465e303b97af66a41e13a25c04
BLAKE2b-256 b0c8a6b769512494e0efd6b987aba90a48707c8efa9f4d48c7046280b4548ebd

See more details on using hashes here.

Provenance

The following attestation bundles were made for snakeoil_web-0.1.28-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.28-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for snakeoil_web-0.1.28-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8f5e0812384882755378663b46dd878441a987aa3da50fd2a5e83422a8d79fa3
MD5 da4490f80af0f39622ba1821c2fada9b
BLAKE2b-256 26761bac5e13f69ea0df338393e8f0d9813f0aaa1870b9aa2110c1767b81cc83

See more details on using hashes here.

Provenance

The following attestation bundles were made for snakeoil_web-0.1.28-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.28-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for snakeoil_web-0.1.28-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 d682942809c7e86c5e64d1ecfa79efc843ecb46ba79201d52a9d658724568ccd
MD5 b73c836472f1ac5f7090a094f557264a
BLAKE2b-256 db4c464044e6f44aa675b5137572ba20b7074dc24f44568618f822963f37aec8

See more details on using hashes here.

Provenance

The following attestation bundles were made for snakeoil_web-0.1.28-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.28-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for snakeoil_web-0.1.28-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4e7e05f5666be96f5e293e85b188416b5b5ecf78ad10dbbb4a8b683cd8b3c67e
MD5 9f9014bb98d9d72195ee070222e3f305
BLAKE2b-256 d2951b1f7843fd29743197d09a810671c2ab135519a8eda6ba91cea98b26a385

See more details on using hashes here.

Provenance

The following attestation bundles were made for snakeoil_web-0.1.28-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.28-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for snakeoil_web-0.1.28-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 aabffaf0a7f19539b980ff233522a559b090495e96272995a112f4aa87b403b8
MD5 84e997b12aa66a93ca9287a0cef9481a
BLAKE2b-256 31cf63ad6cca634f6d6c8fbe6c558930ad4c245bcb5bd71fbc97aca41a320644

See more details on using hashes here.

Provenance

The following attestation bundles were made for snakeoil_web-0.1.28-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