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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10macOS 11.0+ ARM64

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

Uploaded CPython 3.9Windows x86-64

snakeoil_web-0.1.43-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.43-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.43-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for snakeoil_web-0.1.43-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 f4bcb0b0bcdffc5af891927c64415f81ec329ff1948caba466fbb9e998f04518
MD5 0bc842cdb373b0d38abfe59f8424b29f
BLAKE2b-256 255076dd885f95534f51b46e369faeeb96cf0924f5a75b55cb4bb3c1c156e26d

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.43-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 62c3b5ffb0834a5102cdf20355becce4851c11aa4185dd42ae60e998bb20e0a0
MD5 f3a4c74a90bb9b86ad51560987ae0dc5
BLAKE2b-256 2528b4ee492c45910ed8c36b47b11524b9bc5d5111f7d5458d1c8ae4383e0bd0

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.43-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 cf072ce3a432c689ce4e78fc839f78a1d141e7e23f406d133b4176240da7da25
MD5 acdc79a4cf2d660154bfb13d5eeba62e
BLAKE2b-256 e3f24f53625eb76e1fffc21085eba6e46040d79fbd71bf194a48e2be7baafc05

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.43-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 aae117e7381ed42d965a27ee897f382c7d37354c03b25a53f92a7d27d1d4329c
MD5 f8cc38cec979a4a9c06599787f10d3a2
BLAKE2b-256 b30e77b5070ededbc58b55ecc2f58f563c9ffe1503ba9152f4499e4be6ad5052

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.43-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 aa63adf84cb7627d25dbaa283bd95baf6bf947ad1ecfa596ca191bc4ebe565af
MD5 94dc6978d7a6bf4db43fc04e40d67df3
BLAKE2b-256 4bae304a9e41052cd4ec21fc7ff5cc5808fa6476f4de2df79010a9d0eff7d21a

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.43-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e147d62325ccc632f8ad61955f8789af10e69868d9782383ab00f47ddaa6ffab
MD5 07e3fb70bed90eea517946b76ddf4a6f
BLAKE2b-256 ff9fbea3a0d03698758977f4d7be9d9b850c4b03a00d6868a708571350545757

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.43-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 a50bd74dcc8f69971b329a1cef0cc17ef6a244fa95ea244c62eecb28008a1749
MD5 6008981619d1440999823acf8687dbef
BLAKE2b-256 202310a96db065855a33311aa39830e5f3d7bb9748e8ad6444c5a23bd1e7c24d

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.43-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 169f3d6b11df4ffc68dafb3a9673d7cc514360d452b9cf715943f36087101c82
MD5 fc01d232e07e50f135ab4166df037ca0
BLAKE2b-256 07b669637e56cbdf0920f81d2a6c3f3250916dee318818154f6dffe41c97f9a3

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.43-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c26c89580bcc9c37a3f75c42361b893309873ef774fe35a7101dd82f4d53d7ed
MD5 334f99fbd3ab4a7d784fb794deecf22f
BLAKE2b-256 526e1708fea6e8effe88dd31ac209ed55c4b1577a0751275b7aef46a404cc47d

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.43-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 5dedf4176e679fcde9fd95ef3f3f3bffc4a50835c9b4000137445cfe77b488a3
MD5 f6a2eb2a53efa8a3bc3f0440e38c4902
BLAKE2b-256 254ceb24b3af0a8aaaaaa536daed697cae6503082afec11b7442b37dd002a371

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.43-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f64cf696f1511715a427ff1d046e75e2e98dc0ee90b1667b66a68a64ffad4439
MD5 fda716d044861702766f3a71bcb0f7f5
BLAKE2b-256 bf96ab540365f08a4235a8b3f7dc9d121942dfcf3b3d9cd16a6660ca719cd39c

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.43-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9cab61dfe105f4246471a3114b7b69024122b3babfaacbb5ef393029a190f87c
MD5 cb3d9746457cef671a20c9acff8bd587
BLAKE2b-256 2387c02c7ae11219e1c7975e4fa712fb4eb1254e3960f1fe1ab108d645054262

See more details on using hashes here.

Provenance

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