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

Uploaded CPython 3.12Windows x86-64

snakeoil_web-0.1.13-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.3 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

snakeoil_web-0.1.13-cp312-cp312-macosx_11_0_arm64.whl (1.5 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

snakeoil_web-0.1.13-cp311-cp311-win_amd64.whl (1.5 MB view details)

Uploaded CPython 3.11Windows x86-64

snakeoil_web-0.1.13-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.3 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

snakeoil_web-0.1.13-cp311-cp311-macosx_11_0_arm64.whl (1.5 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

snakeoil_web-0.1.13-cp310-cp310-win_amd64.whl (1.5 MB view details)

Uploaded CPython 3.10Windows x86-64

snakeoil_web-0.1.13-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.1 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

snakeoil_web-0.1.13-cp310-cp310-macosx_11_0_arm64.whl (1.5 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

snakeoil_web-0.1.13-cp39-cp39-win_amd64.whl (1.5 MB view details)

Uploaded CPython 3.9Windows x86-64

snakeoil_web-0.1.13-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.1 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

snakeoil_web-0.1.13-cp39-cp39-macosx_11_0_arm64.whl (1.6 MB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

File details

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.13-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 9e297d1a59689870db5a230bdc96b9f42889a9cc508a2705545e210936d69ace
MD5 305cac52c4b2da70e8b194c94fc00617
BLAKE2b-256 1799de1e74a7573459e3e8c79f3aa4ae60b71aedc14da84c7635ea82c13b6528

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.13-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 dd6016f502eaecb6c983a2a5092bf55eff47a0ca5e18df23561f30ed80949cb5
MD5 5083f144d0cf45b6ef720bdf812c5ad3
BLAKE2b-256 488541dbce632cf2cb54b3d6aaa14e89b913953891f55a3302fc636ce1974f68

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.13-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5db027aa7e84cdb7b1edde92515ac8f118bc637c1dbc1b544774a7a916680c35
MD5 7d45f6dc4e1c0dad9b09958e4d164648
BLAKE2b-256 fee5f7827409a7593971f917e0d2c59e44d51dfefdea9dcf0ab0ed8592e52962

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.13-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 897ac67868640254bb105c595bfd2619fa1eb1e4699ee6845607323ded2415d1
MD5 178589a2b5c5753e04daee7fcb2b2480
BLAKE2b-256 050e77d01c5c0c064bf8e09a7c50efc286990b4880bca8444c4b8623e3719b5d

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.13-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 bc6be3ccda2d685ee15ae66453879c0e4138293413564436b280ca21a0a51156
MD5 7de7df7b3d265195b260cce23b6fb9ed
BLAKE2b-256 4abfd0da5b375b38165547cb6e18dd957d42046deb4861ff4ce44c7d0a05951f

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.13-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0b34512031b4d6b0de3083c9b7c8c42950161fb7d099d6939ef449c26fa2245b
MD5 607a04ad03065377bac9b3e010945f3b
BLAKE2b-256 d65131bbaf8ff81dc88623212d8a9ca6f8dd6f0eed80854a271cc9243cedabf0

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.13-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 038d9641130970ea398c06d23f02621ceb932714c35ee6115ffb01a91086fea0
MD5 0b5835eaaf9f27bf11f3237526d0fa5f
BLAKE2b-256 f6756f33ad3db41b167a198b9003e93deea503c66a65a2d50ebe7226ce9310e0

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.13-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3ad6e576b7e776b06b34d26e0a213a962ff9e156dd7d5c1b6ff3e192164e57f9
MD5 a4bed06d3945eb7d0daf4c416edc0fac
BLAKE2b-256 7cc3968962d2f0283305bf5d1ea1a3b9848508759882c355f057e63dc377bb86

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.13-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e61f38005297e73293ceb0fbf663d4b18cebd43185eb4cebf14bd497b0354c79
MD5 aca21681ccefcfb84ecef893f6a48860
BLAKE2b-256 337e464831bf29277f173c979c304c7b06d8bd1751aa13b0a9b874e8d3e4a080

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.13-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 4c37857e849cf65fdbb69a0ebb6459d542399bc8107ae84d9c5acae96e984b91
MD5 8f40bba712ef435273eed4f6ad253c79
BLAKE2b-256 66719351928e7bc80e3a6ed7c42d198ff6a505e93617d11651b5548f15c6fa78

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.13-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 309522917f43f458db4c678e2e8a3bd091fdfc26b005823732de3685635ce5a2
MD5 a24388efe93830d0398eb5d27269a73a
BLAKE2b-256 b6228df627071a372e8e2ecfc91104492a515f4b6b01c1a3f0dfcd0844b677aa

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.13-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8a8572e13287da2f9bc287d10cf98372094b3d73158fbf7b7c6605410f8124f8
MD5 818fb249aee0fa9bfe25765abbb0f713
BLAKE2b-256 619138af9564eb2bdfcb23694a1966bdbac22d05cc69f6a9a593130b7a4b320d

See more details on using hashes here.

Provenance

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