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

Selector-free, self-healing web test automation.

No XPaths. No CSS selectors. No waiting. Tests that describe what users see, not how developers built it.


Install

pip install snakeoil-web

Your first test

from snakeoil_web import WebAgent

agent = WebAgent()
agent.click("Sign in")
agent.type("harish@example.com", into="Email")
agent.type("password123", into="Password")
agent.click("Sign in")
agent.verify_text("Dashboard")

That's it. No selectors. No waits. No maintenance.


Why snake-oil?

Most test automation breaks when a developer renames a CSS class or moves an element. snakeoil-web finds elements by what users actually see — visible text, labels, and position on screen — not by how the DOM is built.

# Selenium — breaks when developer renames the class
driver.find_element(By.XPATH, '//button[@data-testid="login-btn"]').click()

# snakeoil-web — works regardless of how the DOM changes
agent.click("Sign in")

When the DOM changes, your tests don't.


Two ways to write tests

Pythonic — IDE guided, autocomplete friendly:

agent = WebAgent()
agent.click("Sign in")
agent.type("harish@example.com", into="Email")
agent.verify_text("Dashboard")

English — human readable, shareable with non-developers:

agent = WebAgent()
agent.run([
    'click "Sign in"',
    'type "harish@example.com" into "Email"',
    'verify text "Dashboard" is present',
])

Using variables

Pythonic — pass variables directly:

email    = "harish@example.com"
password = "secret123"

agent.type(email, into="Email")
agent.type(password, into="Password")
agent.click("Sign in")

English — embed variables with f-strings:

email    = "harish@example.com"
password = "secret123"

agent.run([
    f'type "{email}" into "Email"',
    f'type "{password}" into "Password"',
    'click "Sign in"',
])

Mix Pythonic and English freely

Use whichever style fits each step — they work together in the same test:

from snakeoil_web import WebAgent

# Get test data from your API
user = api.create_test_user()

agent = WebAgent()

# English for readable setup steps
agent.run([
    'click "Sign in"',
    f'type "{user.email}" into "Email"',
    f'type "{user.password}" into "Password"',
    'click "Sign in"',
])

# Pythonic for assertions — IDE helps you get it right
agent.verify_text("Dashboard")
balance = agent.extract_text(next_to="Balance")

# Back to Python for logic
assert balance == user.expected_balance

# English for teardown
agent.run([
    'click "Settings"',
    'click "Sign out"',
])

Spatial targeting

No visible text on that icon button? Use its position instead.

agent.click("button", below="Total Price")
agent.click("icon", next_to="Search")
agent.click("button", index=2)
agent.extract_text(next_to="Balance")
agent.verify_text("$0.00", next_to="Balance")

Mix with Python

Use Python for data setup, snakeoil for the UI steps.

from snakeoil_web import WebAgent

user = api.create_test_user()

agent = WebAgent()
agent.type(user.email, into="Email")
agent.type(user.password, into="Password")
agent.click("Sign in")
agent.verify_text("Dashboard")

balance = agent.extract_text(next_to="Balance")
assert balance == user.expected_balance

Quick start with pytest

pip install snakeoil-web
snakeoil init
pytest web-tests/

snakeoil init creates everything — config, conftest, sample tests, installs pytest and pytest-html. Results saved to report.html.


pytest integration

# web-tests/test_checkout.py

username = "standard_user"
password = "secret_sauce"

def test_login(agent):
    agent.run([
        f'type "{username}" into "Username"',
        f'type "{password}" into "Password"',
        'click "Login"',
        'verify text "Products" is present',
    ])

def test_add_to_cart(agent):
    agent.type(username, into="Username")
    agent.type(password, into="Password")
    agent.click("Login")
    agent.click("Add to cart")
    agent.verify_text("1")

Each test gets its own isolated browser session. verify_* failures raise AssertionError — pytest handles reporting.


Configuration

snakeoil.web.config.py in your project root:

URL        = "https://yourapp.com"
BROWSER    = "chromium"   # chromium | firefox | webkit | msedge
HEADLESS   = False
MAXIMIZED  = True
TIMEOUT    = 30_000       # milliseconds
RESULT_DIR = "."          # where report.html is saved

Supported browsers

Browser Support
Chrome / Chromium
Firefox
Safari / WebKit
Edge

Related packages


Status

Early development. Feedback and contributions welcome.

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

Uploaded CPython 3.12Windows x86-64

snakeoil_web-0.1.17-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.17-cp312-cp312-macosx_11_0_arm64.whl (1.5 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

snakeoil_web-0.1.17-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.17-cp310-cp310-macosx_11_0_arm64.whl (1.5 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

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

Uploaded CPython 3.9Windows x86-64

snakeoil_web-0.1.17-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.17-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.17-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for snakeoil_web-0.1.17-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 1c6d63b970f5cf7e0efac526da153706f9623e02e3cae32722da1494a920e7d3
MD5 899fc8e0a1f2e0784c1309b99b404905
BLAKE2b-256 7a2c18ec7e80afac54d63946efa4721f255f32ac672569e904bf447b190d7603

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.17-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 98c62570002940929c57db4aad1d5c2a6460d54eaef0134d0a9a86ddc5a0a73f
MD5 2ccdf125506c6635fa18b409dd2bebe6
BLAKE2b-256 108730cbc4345518f5596298ff73ffc9ce2c4b3eee55402f00e72f13eaf53fe0

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.17-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 54aa0672dc681e6049dcbfa882b1fd59632d8138f29b40faa598097fa5b5be6b
MD5 daf53b1984444e94231406e10786475b
BLAKE2b-256 0e070e50e97c6b4f2f16c65acfa1262f74d75cf2f4a7156a75dcab154fbfb252

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.17-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 b79de904a22b8279376ab418167ed3341a9990b8d6994538e1a4cc66cb9bd754
MD5 591e00f3c7723a32ffc33d03d126f500
BLAKE2b-256 b75eee7d1cbacfd1715583dd2982bc2bd68c2313c6ba4ae0df0bf1e043b96fb9

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.17-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 aeedbb4dbd4e13178ff5673b79623b5c3fc9577e82330810a44c598fccb5aa5e
MD5 ae3d456647b5f21db32733cca88536db
BLAKE2b-256 1bd6c7d718e0d47c45fdead80c71dc088096d823e337ac6024c7db73498a1d1a

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.17-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1683aca3489afb91a6bfad2f302359511728f431e83828512b50344831407f3a
MD5 c874e03c8610c4142ace67edb98d9906
BLAKE2b-256 0ef876af34802d143d0124b172e555327751b16287395933f97a30ae698a9309

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.17-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 44583ca600ee9a0c3877eca68ae0a67718873435430aa53c6a71243099e85cac
MD5 e8b1d22b68642c8bb394d1a77ea19efb
BLAKE2b-256 5e2591d64133f8a316530ef73a5155d05299af68ee7292d2b17e44195aafd58e

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.17-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 227b0b7d7db7be67fa367faf9c96440022b34be1b4f06ac8aa41ea22b281a487
MD5 63b946b0538ac292f5cfe3b6cb083ad3
BLAKE2b-256 5ddae8a11e5506830b30c4fdbb37b6ea6e40614f4c2277c6e7699949b7d85b38

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.17-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c92997df31598bc6af4aaccddbb432dcd91e4b347b2fb09cbc1edbe38d965c19
MD5 3c0bc5e21799acaedff2f8445c8fcd8d
BLAKE2b-256 c114e264155d06230b9f68ddfc54b41a7c506e807e1102e8ed8d4487b2add2e2

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.17-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 8f80cb6493e85356e2ed97243e975b19fd14dc1da8ba3d2cc9dbf2480a7cc8f3
MD5 9e442ac2a813d8a8360f79d15f10b08f
BLAKE2b-256 a4f5cc2ab3ae05dd1eaf5e649cf029c2b69ebff75c75f747f064a7ef44f57984

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.17-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 bf7d943bc0498469f92880d9537594174e02389563942054a53ff02a0bd4cacf
MD5 537e0c20099677cf6e3b37eb3d8b1c82
BLAKE2b-256 6ab9a5f85e802f13090ae3de4d84921457ead8c840e6b7a1ad8d26f57f0b7172

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.17-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 adfcb49b3046a5b12c23d5e9affdf06b94731e9c00ecb26a26f09353d7a3f177
MD5 1de76a2d711a07b1b833fd48e79d926f
BLAKE2b-256 1f30b2a6a81d031aba92e2bf671b5fee1e9ffa78db1f4824b6f11d0ec7fe9fa9

See more details on using hashes here.

Provenance

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