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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10macOS 11.0+ ARM64

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

Uploaded CPython 3.9Windows x86-64

snakeoil_web-0.1.20-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.20-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.20-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for snakeoil_web-0.1.20-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 ad8aecbf8d78873103ba22bac8e8e8dc59d2bf290e083989b8c45ac99580aefb
MD5 5b4719656b6299d45622d3483906ea7d
BLAKE2b-256 5d0e2597d036a2fdf2c35b3d855fe954f58747fc2bdfaed01eb2f16dd57f1def

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.20-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 02ec0358f37fe57498eaf7fdb9225cf690b11c287b445d7e292eadaa1aa12836
MD5 6f12d292101172bcb45d12d73555bea1
BLAKE2b-256 d9db05ca0cd84824e7c6e65a4f3a420ef1ca17ae4d85adab2bb2e0c8e72d37e8

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.20-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ecd22e8b348545ae87a125b09767f75c613cf0025f78854be513da3f391e2f31
MD5 c5c3bbfebd078c1a9ba66d105e047f75
BLAKE2b-256 54705b793048c5b2a0ef5100d5c95da0dfb3278992eb5fa501acc00691536c33

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.20-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 9324056d03bd2d426482248e52bb06587073def1e1501f43dcf7f5ec26ec5c2f
MD5 e6c0f125f88074c70a8159f6169ed683
BLAKE2b-256 3d70e6ae730051acc004a3c33593427f9bd2a83c213aaab2b02a1d6f88c1310d

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.20-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 bedbc660fffd3b66446b419468a3a07c5c66d842665331b70e14f8e30d749986
MD5 211c3d6057a496536237334c08dc9ce7
BLAKE2b-256 8867ed66542e94f4794911974876536f7bb53b5f352c16ac6278cf0338cbe51f

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.20-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5cb2d92e06ad9fee4d8a46f4f3a07ce190db332e91240a1b1746af8d1817e926
MD5 0ee55c8bf2c260ad36abff6a8e224efa
BLAKE2b-256 e7782944c8a24041e38c7bcb9c48875a04403b63243e2b3c913b5a9e582b2d23

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.20-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 61e99363ceff54dbeae5323a07b67953b1014c52d6c689d4f5b64353e85a24ce
MD5 7cd2f578a1dd4f3e127200f8f5bc617d
BLAKE2b-256 04653faf2aca7d004d2d1ff23c03d053d31f0ad840907e177c017c7a4256192c

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.20-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0d1c255c60d84d7038319a21eff874d2fa082ea3de5060d64426a7a57aac417d
MD5 ab472676527a4de6979e28f3003a9f87
BLAKE2b-256 162a5172f71b2c9fa4841753e6489082151482c101e4a893bfae93fd95ef5aa9

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.20-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 554bac0140497f371445e460ccee0ac6b5b2247ec8d8faa33e882755b6559349
MD5 6a84289e0480e71dbb314069288b3cb9
BLAKE2b-256 92883a2c4965251fad20e878549eaf63540f412dfc5d500633e2b4a99547bd1d

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.20-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 364514c1a13ca223f352293399a61152fa698693a747ef425bedcd6471d75920
MD5 06be1822c02f558b402541b463873c05
BLAKE2b-256 6d5648b246ead1140dcf077e241801dd6ff02b97b7def20708a910284093fd8d

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.20-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1764a0f3f78337af15273dd50d5735d8873a4c62965e2021ed26a686c6c7b91a
MD5 0c005c0fd12cdfa5c6d92982b8fc0cf6
BLAKE2b-256 cbd0f95f9c4d1f0d70d116bc0965be18f1c4ba025dc7f55bfc4f765a26e86be4

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.20-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5b68768158ea20a3a6ca33758781ff61c4d9ff747a0655faecf76963030f531c
MD5 12640cdf70af2af96bdc06366617aeca
BLAKE2b-256 7250fb8d9e12fe66f935885929af437137779c6a9636a9da878c636b467a4a38

See more details on using hashes here.

Provenance

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