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

Uploaded CPython 3.12Windows x86-64

snakeoil_web-0.1.40-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.9 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

snakeoil_web-0.1.40-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.40-cp311-cp311-macosx_11_0_arm64.whl (1.8 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

snakeoil_web-0.1.40-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.40-cp310-cp310-macosx_11_0_arm64.whl (1.8 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

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

Uploaded CPython 3.9Windows x86-64

snakeoil_web-0.1.40-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.40-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.40-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for snakeoil_web-0.1.40-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 875b75f5876e3cb93d8ac6cd6afdfdb063f7bf2dd6b24a73ba89886a2657acc6
MD5 0a0e56609053f687ebfe6131fe9a41d4
BLAKE2b-256 85a0d848dc5946569fecab95094cf522200b57ffabd7aa5881a19a1523cfaf19

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.40-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 449799152661e7a6985a9544501d4f1ff6c4d512e654d3e6ce2b930cfbd09169
MD5 63162113df63cdc2b8a0cdec09d5b0ea
BLAKE2b-256 4d521626757ac25075be60021825dad28725bdc905027782d42b8558a52ad054

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.40-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2092bca2d77db89c84fb07a5bf47f752270a2352119cadd0b70e558d73496024
MD5 1d9a0a54098e39ae98aa85f908a9ac4a
BLAKE2b-256 e02d04074dbb169bf023a25a64fb2f12ed76a63260fcdb19866ac76163a0f459

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.40-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 286d0e56581d5cbe6a8a6e66fd25e3344abfb531ed3158d6deb23b8721c590ea
MD5 b3eb6823f4026b293f49443d3dd56f2f
BLAKE2b-256 1daa4022c2f668b328ab1db48f0439f0c9b5e5cb61dde704fc28a5f189184508

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.40-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 af122d5f6f8f562de3f72238836818f717dae7cf246eb8f334f0762c40e19414
MD5 6f6ef86c8e9799f0cf4ebf6d25b5e0ca
BLAKE2b-256 e2a4f46ad627750c2ec30dca67a5151a0734bc37a5a28bccf9d948bf69b22da1

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.40-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5892dfc76a8322f4f267201640da73149c2acb554ea9ea4666cf1853e4c0e035
MD5 c381025df10850a3fe11f1d5c37bcd31
BLAKE2b-256 e0fbef8f5455bf53a497ad2bbf45cdfcde37867eb9d18ad2baeff3e47557d9fe

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.40-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 697d00216f1c8ecfb8a5b2c45a25da49bc449b520bd2d519c69adafb42916bac
MD5 4688af83c8c006229938557edd4102ad
BLAKE2b-256 e1908b6559e7e4b8ee59f902f8358d8d7bf13d560aaee119e46189e7fc7dcb18

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.40-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 58d4f3cfdeee3786e5ef51356038e644d727f855cac43455f3992edaefcbc919
MD5 aa916e24564bb556db2c8853ff6ba724
BLAKE2b-256 203ed4ad568136e6a0870d2bc6c5856518e9515fb9bf50764334b86b295ec9ae

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.40-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b58d66bea90b091bd7dc5b6d091d28a22843735d5ecd4e6a08cca2beee0350dc
MD5 a25771fc749f5bc1d347c5dcc33feeba
BLAKE2b-256 687baa71806ba2d606dc1067e62cc03413de1465de9801bc9bc8022c177583cf

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.40-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 1ed06619a67e260cde13076206638bc169af92df763f6605586d383f5ec59fc0
MD5 382a05f5f93de2fb6de0645c0dda642b
BLAKE2b-256 5c48ced4f647826fe861f198852f0d1c1b6bf72b5584f50459afd880f345015d

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.40-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 bdf1c95c87f100f89257cb8451ce28c8ac9a5746486ee5e7d3b2ec0fba8c8a12
MD5 11250277450c25ba8ad8466349199984
BLAKE2b-256 1869e42e990243e4725312e931923842d504164850ca1fa37ec455c92bcf6dac

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.40-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 11d28ede2671e233c90c48aaec3e046e5e732c306fb9fbe8ba70592e23a15479
MD5 f8ec7044072d9a115673ea45f831d3c9
BLAKE2b-256 fb1b6da43351f8ab40a8db2dcee7c852dedb79fa6f331d134c6e1bce1b9f96ac

See more details on using hashes here.

Provenance

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