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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10macOS 11.0+ ARM64

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

Uploaded CPython 3.9Windows x86-64

snakeoil_web-0.1.21-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.21-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.21-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for snakeoil_web-0.1.21-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 8da2405e27868a47cddeef2e2b01b284c0a07e33a3d504a25c8e6314c5ee734a
MD5 a72d144637af2f9f4efc70a4c8f9d326
BLAKE2b-256 9f9bd3a1c5b55e5403074ccbc5e6d813ed763ec4be5e75c4b56347e87a307d01

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.21-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 efd653a62dbfa5c179b6e346b06637ad511e056742402e76f761aac31594d0d4
MD5 8e8f28ceee6930aec59a083bc78bca52
BLAKE2b-256 4a5b602c536d5ff4f42b9907ebef88446898ae2eb56985b3f98722276e414654

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.21-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4ce6aaeace963f3434f57a67844c4b1ac62473e7592cb0e6971b25c2a69b403f
MD5 c4020acc28734662dd7be320aaf638d9
BLAKE2b-256 4690e88d5008b2373c506585e99f3ff1f5635373d62122b016a466105ad65735

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.21-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 7ca9a41afc5a04561a3ec6529ba48b9cef9374a609c6a318592493fd264be39a
MD5 a38b803f50d0102bac9e7ae421e80ec3
BLAKE2b-256 637038156455f979ba0f73332e25ceef4049d23472cacff6fadca1878268cd19

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.21-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c8a7d14771e9639a98256bf93331eea8bf48c570b1a899f3fde4706cb962b30b
MD5 ded2e3ed98d4362601ff7d286ee85a1d
BLAKE2b-256 67a9a71b0d77a458dd9349b785f7bce189501494cfbca22eb3196d029f49d230

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.21-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8ea30b0ca04e8f6bfce479a552c23200f69087e34ee51629b4bd9b7596c1ca4a
MD5 0f97871032ddee2cecc804ad54aded39
BLAKE2b-256 552284e6a9c97d8872ffae3c23550157fb727789da990c5ee1d474741257cf60

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.21-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 5dbea8681febb3323d5eddbf910c4a6d672e13639f54d71e852c326fccb9d84f
MD5 88769140161e8feff72530ceedc3218d
BLAKE2b-256 7339be96fdf9092ccf4fb3cc1ec10cd43780b802321ce7e1f625866925e4cd15

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.21-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 93a67c6e3370552dde2022f6025c3d794f26dde87b24fd9672c1e9177c72edf2
MD5 fa58a27a59b69bb16c1eb26798f583fe
BLAKE2b-256 98cb5ba5c3e3d0c2fa68259a445d9104ba7c3b7fef79604e80295a239f410a28

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.21-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 cc426625122c122d17b25c63a66d114f5d0aefe330db0b83b587b1e7e6245827
MD5 5fbd88adc8e2493b70a322ddcc5dce17
BLAKE2b-256 d05cbb98b199895035c6df3fdd0e9db15323922386e1441411f5749a4067e46b

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.21-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 c8434c0c1b5109fdd29a4cdeb296a0da8ec452d98562a790b5dda5f302a4d3ef
MD5 1ab231dd6a490fed092e60a160100df3
BLAKE2b-256 3dfdca18250bd2eeb3f007b3b141706802890b4253369bee51ed7f86decc08e0

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.21-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d3b9899203b5d372a72004ed7541de79a00f10b7dc989aaf0f30e110e6d4dcd6
MD5 37db097a2268b8474f3dd341bd4e2030
BLAKE2b-256 15c1a559645d988b6052b6a76f34af58fe78b4b9e268cb9bd8be461c86605635

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.21-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0fc5ee37fd5e57e6408201d66d67adb848fb2cf505c6f69e21c5270f8b14ff79
MD5 ad5d231cc88bc5f6165fa0dbccbc7d46
BLAKE2b-256 6135cea50c1f5e484da999f1555338ddab53d5368aa41588f85b187e7415b56f

See more details on using hashes here.

Provenance

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