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

Uploaded CPython 3.12Windows x86-64

snakeoil_web-0.1.11-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.9 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

snakeoil_web-0.1.11-cp312-cp312-macosx_11_0_arm64.whl (1.4 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

snakeoil_web-0.1.11-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.9 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

snakeoil_web-0.1.11-cp311-cp311-macosx_11_0_arm64.whl (1.4 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

snakeoil_web-0.1.11-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.7 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

snakeoil_web-0.1.11-cp310-cp310-macosx_11_0_arm64.whl (1.4 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

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

Uploaded CPython 3.9Windows x86-64

snakeoil_web-0.1.11-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.7 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

snakeoil_web-0.1.11-cp39-cp39-macosx_11_0_arm64.whl (1.4 MB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

File details

Details for the file snakeoil_web-0.1.11-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for snakeoil_web-0.1.11-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 b3a48c6d53d67ef65e7eda40538b8f06b1347a7d6e29c395cef5b3c501242b4c
MD5 88b234d9a5d486f53bade2db963b2d0c
BLAKE2b-256 9d1ef5451da910eae26aa4e1a05ccec351bcd0b8a1a411620a83e62f4271223f

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.11-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0fb26648b4e76d3860759a1bf800830f7cd0b6fc6a1bbcc2fdc95cf4d9dc394d
MD5 197005456e0c7f2d6b0ffb8c3e11fc9d
BLAKE2b-256 ce85fc7c1aafed9f9ebe53c87ab9543d0fb8dff35e55fe0b18beb03813c26536

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.11-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b5e17e825b59a93c82fe3bb4473586bd3b1530549e3982121aad0b4653eedf2e
MD5 6f3a2ef79de6b7c761c1cdc2f416af31
BLAKE2b-256 cb9e6c3cf4a00d62dd560a91ff5b7ce0ed751e7991bc11ee375674ee8302a537

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.11-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 d2d1cef82ae0d3f2675a9233b6bc3f8797d5a059ea9dd193df28cbe1b8534e53
MD5 7795ff2b2bf30066f3d41b828f5be429
BLAKE2b-256 ebc2434d06cf825b184e034bddb016faed6326aa0f9f5345823203bb69cdaecf

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.11-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d08079734bb0999b572d94d5a6242ef853aeff11826858d828a091a200bf32bb
MD5 7e2d4167a07f4622abe9046d6003bd77
BLAKE2b-256 787cda6f52ecd7b41f510cb25f18849f6291d239f42f34f42af9b40942e5ecd2

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.11-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 351d6bb5a6be420dfdfdd1bdae2b0869ae0859560d4ca1beda164f275125836a
MD5 6aa47dfa1d6da7e5789daa7fcac62997
BLAKE2b-256 5304f86427656d556cfaa4e01259dbac601a8469bc87a31aaf5e0c48bc6667d1

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.11-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 8cb861b8875c534a4102ca474367a7fa1cc21eb854187b917fb1936b40d8302a
MD5 8dbe295e5c4d66679ec4dbd6a6c61b5e
BLAKE2b-256 07a0ea23218c2d6c24666136cac949d9519121d9fa1ca8c807ea0ad16066af57

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.11-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d1995461e1546c3bf277281a5daba40fdf6bad4020c5a8088c54c7419a64f962
MD5 5a12b09661f9dd452bef9ae5160f14bd
BLAKE2b-256 962bb777935a04b42015f3d2c3f96b7985e92b6793a45ffae6ad47e99aa855ac

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.11-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 12a4013c2b35e265f9fbaa54279a8d28044b0ece070b1774be430815979a4ef5
MD5 ad712eb92b160fdef03a9b6fc87203f3
BLAKE2b-256 b590d74eaa5a4c155ab2c8e1243c61a10e3f5ae93af13f5b206dd28b01db5217

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.11-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 811fbcfd0110de9e023c97d07a282bc096f51a32734c85d63c3478b939e62c0d
MD5 cb6ee10aa4c6d1739281de1bd9bb17c2
BLAKE2b-256 4f9b8386ab6fe3d67da1489696bc53c4add41e3bb8061306af8456102b71676f

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.11-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ad53f1a485546da7921b01bb77ee721ee89210169ef5391280a9816c02d65e74
MD5 396d5197d8f2b9708040651c6c49dcd1
BLAKE2b-256 08884ab2110cd479fdc8a225d903dad5b9fc9c6f05daf0e492f850c8a57a4bc8

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.11-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 663055afdb510755afb2f6fd689b4a06a8e9ffa7a23f62c4ce065eed6fdc6960
MD5 58db68ceaa53877dc8a9283e0365a144
BLAKE2b-256 db3c0e55def313bde8e70df7ea9c7601bc46bfeeff175ce3b181441c63ec6991

See more details on using hashes here.

Provenance

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