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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10macOS 11.0+ ARM64

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

Uploaded CPython 3.9Windows x86-64

snakeoil_web-0.1.19-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.19-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.19-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for snakeoil_web-0.1.19-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 959b90722718f509f42b59e595c7295a420f5bf8c91dbea0079ab913e9f21806
MD5 4ff737f2e1d61f1be1694a82e398464c
BLAKE2b-256 29735eb47617339257ece6c9bfacfc0ede0f03fdb832e5c3d065442a6fab67f2

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.19-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4a67fc3ea21bf8fdd78ccfcd8ea61291a721f9ad9d55a5a4d07716bec0a42d9b
MD5 b9856e7861fa65f128a506cb9fde21e8
BLAKE2b-256 c431773f08a1855f3e1bcb454f94052379b94ab351acc7c2379860f5388d36fc

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.19-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 687744894c1307b13bde66198a23d7062fb2812d61518f10da387939378db346
MD5 1c9f4e9fdbb0bde77a280f130b8987f7
BLAKE2b-256 31a9451f540474ccaa29137ea7decdda0078114fc5b9d02d3e283116745128c8

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.19-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 b63571209e1a664ca7a919170603346820fa733ec94017810656213120d33fac
MD5 77d581e6d8b94fba8609cc5571c273c6
BLAKE2b-256 71106a9fdb127dfe553da9c834fb47912aaa43474022f6c8e0d0118773c1a98b

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.19-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 fcbab67e1b322894e4daf7c92480443dc872b9b188586aef05f8dea631fac4af
MD5 b1aca7ada9d71f78bbe41dabf1cbd483
BLAKE2b-256 e187fd8fbaeed9a49a9d8375fb53475bb5483827327e7878038b3bd2c2198e10

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.19-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 62c42d0a95cd69094e0e699d483ce31e7b6a63c9c42db7354de96c82368eb27d
MD5 6ec27c16c3a4149a79f79c90953be34b
BLAKE2b-256 a76da6bbdcd973a6803c1f6ddddac3db6214d2fa9d7402f0fefa3e8567f3a180

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.19-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 6ecb2f6689914868b938a2feab037628e4fa6b59a8f8f9fb91995df9f6b90509
MD5 655caba2e8f4b006a65b18047a685cf8
BLAKE2b-256 3dacec27520a584b9adf78b48ae08b138e6f7708065ed130fe8e2d3945bd5a5d

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.19-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7edb5ff22d436d68577a33b073a915cfd51a334bb1751cf2b937da3ed8289344
MD5 314fface11057023d47770dc5f40235d
BLAKE2b-256 e731ffd7d7e1bae661b7a64ffe11a41bf1cafbe9a9d7a5e4013fab83be917bb0

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.19-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 971cff3d0c48da66713ae0784828afeeb804e124f48a919a83bcbcdbb9b250e5
MD5 a55ae0984684ad3b4517cc10605136f0
BLAKE2b-256 7224672c4ec06e6d1e93282fbd37ce44b3fe68e274473fafb96054c02ead9dff

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.19-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 4ee07f33fc46aaaaa5380a40dfde9f95e4c74cc76843895bc4dcf25eba1d6dc0
MD5 7321f8953f2be1394a554e681e45325e
BLAKE2b-256 9fd2c45881f80e1b74d11da56e46c0811fb9e335bb5cda49afd2ede8dee7ca64

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.19-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 dc8767745a4bbe624df09bcacab24bc0ce468a7c19536b93f407ca745816218d
MD5 500679d5f32e21f803da590b63f6388f
BLAKE2b-256 934719d75556ab3c3ebde20e7791ca9764169fc8f2ca05a077551f220ed03b46

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.19-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4b49d3cfd8350178b09e88e12d58a34e86257f1f1ff60fe04465dfee2973f74f
MD5 e612a0913ef10bfdf38791fe235378a2
BLAKE2b-256 95b68208373c5da333c23a8e8a8b78cbe127efd68006280a092d31f055cd279e

See more details on using hashes here.

Provenance

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