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
├── conftest.py              ← pytest fixture (browser session per test)
├── 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 = "."

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

Uploaded CPython 3.12Windows x86-64

snakeoil_web-0.1.24-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.0 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

snakeoil_web-0.1.24-cp312-cp312-macosx_11_0_arm64.whl (1.5 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

snakeoil_web-0.1.24-cp311-cp311-win_amd64.whl (1.4 MB view details)

Uploaded CPython 3.11Windows x86-64

snakeoil_web-0.1.24-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.24-cp311-cp311-macosx_11_0_arm64.whl (1.5 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

snakeoil_web-0.1.24-cp310-cp310-win_amd64.whl (1.4 MB view details)

Uploaded CPython 3.10Windows x86-64

snakeoil_web-0.1.24-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.9 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

snakeoil_web-0.1.24-cp310-cp310-macosx_11_0_arm64.whl (1.5 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

snakeoil_web-0.1.24-cp39-cp39-win_amd64.whl (1.4 MB view details)

Uploaded CPython 3.9Windows x86-64

snakeoil_web-0.1.24-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.24-cp39-cp39-macosx_11_0_arm64.whl (1.5 MB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

File details

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.24-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 cc3acc5f544396f5ddc8f0c2b3c7f9d35a1178989eb68952ba9afeca88a5276f
MD5 30cfcfc94de48c131b8a697650347a5c
BLAKE2b-256 883e6cd7f1b3deee1326b140d66a46bdab8f938229c5cfaa433e893a73565ca2

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.24-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 995682381dd13bacf828c46d7478d5d3a9b42bd82c3baff908c7385a4d552c66
MD5 675cb8dc6ed3db67976d1d1dfd625c98
BLAKE2b-256 d08b893d3a68aad87af3ba9cb6d35c71478cdda146e6014fc071757fde197d8d

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.24-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 980b8037566a9757c00f5d24a7e114073377c12c150599527d6dcab3438fa228
MD5 c5b9b799a180414c56738a92e1d3e8d0
BLAKE2b-256 1528f48f8fd498f26bc5a901a9a21f592eacb75d552ba7eb602f33b720da3181

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.24-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 4f6ec8321b3b2a7a0cc0b465182a24df584e53d38afdf144107fb665ab2c9839
MD5 2ea6ccbcf6c169d31cf6a3ae7c1d4edb
BLAKE2b-256 dca8971778336b7f66b15dcbe8991da9e9c376babd997ec0492cf49ddaf62525

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.24-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7d81033e4a2dc5ae4a0bd743d1708134f206c1f4a2ef07eda3f09f50207d8fbb
MD5 be0f862ad123ac2be4b21fb7ef9c36b7
BLAKE2b-256 1e8d5ab1d2439370412c88d261e508aca852c105c7af4dda79f98a99e35a46ce

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.24-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7b3abcd1897565e1880177655c038306e653015eec5c288899a71a7f3e5fb6c6
MD5 9c5c5eebfac4e027ef2c85d3f2ddd378
BLAKE2b-256 d2da7aabc707acf0f7afe66a30df69df302072a42f0c9f9552efd7334b711983

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.24-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 c518de2706bf72db78ae0a365506895b4e274d4c8ee03734f6b9fcb2cc58569d
MD5 f7bb77a41b02e4f4bed2fc5f8870c449
BLAKE2b-256 0d47849774dcb19cc15414cdf83da2a3e2d1fd3beb3fc0708733379c9f38b560

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.24-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3a4f4125e822faf3dca8c072f74ccb3bd55f62ff7941d61db9b36980bb3f62de
MD5 52d314ae674a0bd5ea478bf636691937
BLAKE2b-256 f94fe95d82b4cb2feb69ab1332b5277a6236dcc392d83a8d1ace13cf8091550f

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.24-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 35ca3fdee27032fce73531b8d49432c6a196325cefe9a901e7aa3a08db0e80f6
MD5 33501e6e49ec5c856210b4b2c3bd1e16
BLAKE2b-256 4fd6175e7b166698dd49e6d72ef1d78ca0ec38f409255b339995213fe8f06be4

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.24-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 49158c9043340f5eb656953063f5e188c5b0ade32c8f6dc4fdaad1afdfe6bd7e
MD5 e4c63182e766065052a27f45721a4a09
BLAKE2b-256 6d7dacd1b6badf71a453a4ebcfaefcba537fa6cf01138366204caf3c757f6441

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.24-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 21e60815aaf9dfa8896a3d8b59b94fa552af8e65e0dd79df983969ca9a605f7f
MD5 b70e8308acf0824717bccb412709c59e
BLAKE2b-256 8964b474cf25f9d232f758ad02c91082dd5066855df7e20943fa415762fd87c4

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.24-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 534c101799ae4ae391c188aa591b5be02e5c4ea43a3a473910ca0710d8973f1d
MD5 b4861f3b2c9ca3296731adbfba3ce353
BLAKE2b-256 a369878156e8a964c85c425e9300ea38e96cfd50cfa0f0db3f86e9e65ec7ae22

See more details on using hashes here.

Provenance

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