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

Uploaded CPython 3.12Windows x86-64

snakeoil_web-0.1.31-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.31-cp312-cp312-macosx_11_0_arm64.whl (1.8 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

snakeoil_web-0.1.31-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.31-cp311-cp311-macosx_11_0_arm64.whl (1.7 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

snakeoil_web-0.1.31-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

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

Uploaded CPython 3.10macOS 11.0+ ARM64

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

Uploaded CPython 3.9Windows x86-64

snakeoil_web-0.1.31-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

snakeoil_web-0.1.31-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.31-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for snakeoil_web-0.1.31-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 107776d15d2d41f6fc045b2b203cfa8439594a52ced88068e7b2cc5bc3b19228
MD5 ececc9957adb5b7d6dfa1c4f79668afe
BLAKE2b-256 317a7cf0074204687214c7582c0e3e126de7c21a640e89b7e9e648ffd86ab97f

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.31-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3896ccc7b39a4bec75f473472df55deb82a2f123a7cfc01e2a627cb0162de726
MD5 6dcddc465105f32113364f34adf77f94
BLAKE2b-256 006fdd4e1f2c90763c3c4f97234b45de954279f04bdd45dc29de62c771063002

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.31-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 92bf56eb14f8a41ddefdb4106b96b3ea5056f525b8601b2f70ab8e31d3ba7029
MD5 f5f2c0170220f5ef7d037ed5a595e4b1
BLAKE2b-256 d791d9804d0a381c62e48f71b701b23659e2622a3b3641f222d2fc58d1b5be4b

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.31-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 31feae2e7f91a28e108bf8bf87888de2b992e2a3ba2ddd8942dff16a999a1c1c
MD5 abf9ba4a191919ca9d8e8a1e87c61045
BLAKE2b-256 c8e5f62a16de50ed089a7837c3d92337f9026db117eda0fa7ad1c5917fb279b0

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.31-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2604998de692fe9bc94dc2d9ad54db902a7ab65cf9fe1e1d9c1878681622edee
MD5 c67220a28641e3707fbeb667af98f341
BLAKE2b-256 78f2a437d2c8ac5ee944d58c5144364fcfe4b9f9b4d6bacc8fe0541909568e3e

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.31-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 646b22be92f7b7b67dd9b1b1dba164e43a6013fe696d3b70e755547fae78b599
MD5 6ebedc610fe3d61163b6a43afd4ee45e
BLAKE2b-256 c7d3e7c805652921ec3c9ba3b9de9fcca5a3e9fd9f61dab1745bde3a81d0854d

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.31-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 8e37ee5acbfd698795c9156d3cd3e3826dc986b3c037e9435d9c96e52da3b170
MD5 ee6cba5873281ac9c79e086c8fe59c01
BLAKE2b-256 072ea6c6cfa42eedb7b55dfe7e211d4834e1ef2e4ab9d537ccea73f39aadc74b

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.31-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ff44ff426156bc855deacc8f242f8c1a7e72aec98d0c5785c96a10bcfa470f8d
MD5 9fcf373da28f74e4effb1ba3a9237fc2
BLAKE2b-256 281fd4ec88733896880201c824908312899c78d79fbe891f08cb2c666d02314e

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.31-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a301f05b321269a71436b9edf1e08f099402896c78aac5f18767ab9c1b1f5fa7
MD5 d51a5320a3b35e4c44e154a68e60fbe0
BLAKE2b-256 a14800cbd02a71e3d73c731c0df4a49213dfc079e6176aaee01b07c0366dacf2

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.31-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 89df04de48c7d53b32525a6826e3a7924ccdac0ae7eb5784fb0dbfab3981552e
MD5 9ae5bff8ee87e6e4eed76a52221ba8a8
BLAKE2b-256 73e57fa8bf7321e4f6f81e543ccb39ed65f5ad2b6c9b2063f7d6e4a23a6a93b8

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.31-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7881804a3cf3b4ca9a8e60f496d7a30c6d208b2916bd1b49a1f0faf15ad17797
MD5 408036220e9721ff887c66388eb7b34d
BLAKE2b-256 7d8ad83043e9f24a0ce3e75c892d830fbaac76c3269a36f0905dbd7e2517f0e9

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.31-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d85c224ce81b89f24fc73a57925550b25e87b138bf4d08fa90d9bf5391391c51
MD5 db26ee126ed6b12a646d7bd40a0814aa
BLAKE2b-256 2751f1cedeffcee4929ea52e58eaa46e0a5d3173d10ec0b5e7d43c5f2cd622c1

See more details on using hashes here.

Provenance

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