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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10macOS 11.0+ ARM64

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

Uploaded CPython 3.9Windows x86-64

snakeoil_web-0.1.45-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.45-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.45-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for snakeoil_web-0.1.45-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 5279c90701756bb9fb1aeb4f539140832105bb174d3f6d94bf99f9e25318d4ff
MD5 180b0ae179b2cefa25593db1837db3bc
BLAKE2b-256 b2801972abb6243c29cd810e03486d15c489f9bc4a1904ab82f800b87c509639

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.45-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 644304e7a834067d1c6d7f130071f2558be02ebf0186fb738bd38be42234d3b2
MD5 44149d32a90ef8f36a51d47d4c06fcad
BLAKE2b-256 a7d12a548534056f7e3dec83a9ee2b2ae64587f295fb89442f4ddec48202f3f2

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.45-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a9b2d2ec4248a58fed5c94a307c253a7ca2b0886e99c2fb22f92ad30f5d007f0
MD5 97901e9bb8abf730a367df01224e5390
BLAKE2b-256 91229bcdceac6ed9819830c65edd8df3dbd60f1461b1c4bae3678802e6599ebd

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.45-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 fe1cfe4b6a3d566d568f5cea19d3b1da6b7a00ef2734dcdf863496cc33cd0b1a
MD5 0d81151571ec8285cff7fd1c82bbdeeb
BLAKE2b-256 88b0213dbdfff628d5dc4834e4e163397834df2e1de348764833ab3c901c3aca

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.45-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 6d9ce8459aa8b5d3ff87aa5bf578400b88528fd238a3870f2f88b663f9451b5e
MD5 db9ece61c03af288f44443e86854b51d
BLAKE2b-256 ab52e95348cca2e04fd23f8df7ac3c17186e3f7af6848139a6d76149cb337b19

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.45-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c9355937a9678cb1592010617f8b16e7ca0c38b9f6caa2529017851d596a871b
MD5 c8c0f6142c16f050b04e756a7333e203
BLAKE2b-256 951612da9a6e7c5bad1c12bceb1a02ef94643cc40023ae53d1cd6082da302aa3

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.45-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 1b19f166621b749868fceee6a6d27476391e464ea9e9c39df2fb619d4c9a6a4e
MD5 b53e0b8976fb0f0b0e0261e7f40830ce
BLAKE2b-256 668ccec5054ffe86f13a1dd94871d556aed62e15429f3103c5e4652d8856e837

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.45-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 68663df5624007bc4ea20efe98d12545220d99f1956d7e7cf995807f3100aaa2
MD5 7230b6281f7015485a644ec1816a8936
BLAKE2b-256 b9b16e6a04220b2d82b72ff9193d12898007b003dd17c86af9569425602792d3

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.45-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0d06103cc0a99a03e0085071fe58192000d3da605b349a71ae4ccee511a94805
MD5 63e36ffffb630e4fa0af5c2a95613063
BLAKE2b-256 a6fdb8f27c9769bdef94e37c818303b3d6d335fffda95f272f39304ba318728e

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.45-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 c33d21a02f758ccb326da8e8fa8c419c22fb7b9dc75eed8fa9bb025652bc1839
MD5 49a2572657afaddc69dc19057a85b10f
BLAKE2b-256 4707cd8b72efe5760bb028237c766584063571ac1d95bdb715f98548bf6b1dc6

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.45-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8d9ad71ecd500389efc93aa38d4db14936608c336e83b382fb06e9741122564f
MD5 bfe029d461e3df939af8e8b967825e3d
BLAKE2b-256 35535f602944c0ead54db75d29bfb98159ecaa875341a6fdb3234d776f396d9b

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.45-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ad5151e07949ca3f25e769b239b98f1c43ec762cbd382337e9050cd013e20e16
MD5 9d60f07ab59fae29ff4827be081f7ad4
BLAKE2b-256 2f2de24d0a0aa3d285942f2b8445f30a12902ac925bbf63d059bed373c12240a

See more details on using hashes here.

Provenance

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