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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10macOS 11.0+ ARM64

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

Uploaded CPython 3.9Windows x86-64

snakeoil_web-0.1.22-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.22-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.22-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for snakeoil_web-0.1.22-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 6cc5d3cab0042bbdf8feb98cce8620bff9ac91a55b18113c4bd7a256ec2fbaf5
MD5 479928f9c49bcf8602fe16b21be0c06f
BLAKE2b-256 bf62e38ed60922244ab277731f3817aa5a366569042c10d1fddbac41ac4c29af

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.22-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ed9890e73ddd6afe412797dac306d658df24f426977f6a49d1628f1e79481a88
MD5 d0b40073dd7122956680f322998379d0
BLAKE2b-256 7726b97ead23d87203ba32b71ad3bc7ea95fa0d53c4bee9f33ecdc58828aa2fb

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.22-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4d8e8e87bf0bfcde5127d0c879cf79e01aafbca60e66af939be5dc3247463bfd
MD5 418c05d60ef914b3bdb7f1165febc706
BLAKE2b-256 2080e6b64b16c955c33a640022b3d7d8dddcc400d844782d38777fa8044b6cfb

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.22-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 bca4bbb485bff37c61201fefc0a66ea1d76e2b24b92d066384f418470dd12603
MD5 134b5d218a4fac44b6e345daacd03bd5
BLAKE2b-256 34963018bb6b95ff82c94fffbd7c32f7fdaadbf59482312253ae6da8b34a57fa

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.22-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c79644692c47f0591670c523b4c4e136b295b41283981e28515811584d82a45d
MD5 0754a97791c982676f739180ffec83cd
BLAKE2b-256 2f86d083639eb604f749f1e467ee5b9d3614751ba24eb272811ffa60b9ad3d90

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.22-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 94c6725806e1b93a09efd8ab3865ac75431ed4c1390d2fc9b96e2c4ab692d50d
MD5 ab97fa2905a9a6fe95853cb0abfadb31
BLAKE2b-256 16df69132cc751699d666cce06eb1fc0b3754b6a4059e78631d3195a27079186

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.22-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 c3932a0e9f79813d49b1510301d017d9bf51ddc58c302136230ea06fa89ac360
MD5 7219629b6c354df2985cc1f0df2a76bf
BLAKE2b-256 061c15ec0b46c47fa3e142951740299d15055c54072f54e1645d8aaf04756806

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.22-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 cee4b05dc93d8ddbe751ba49dc8b734c94f7bf9a20c8a7580356fcbdcf2b6fa4
MD5 b36323beb90e3fb3dc5ea8655515af18
BLAKE2b-256 1e8f4af644a69ea87488748cfbfc2b674f07093052735be1526749f2f108dbef

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.22-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 41eec1eb57aac6b4626743f658321430fa8c4921f217686f6c4e7532cc7f2c05
MD5 3e7c29db51e02e85d74f52b92fb8a44a
BLAKE2b-256 4ec2f44f1c909eafb5390995a5a7519613edc00fca04b7196d1157dd495d93ac

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.22-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 b3dc0f71c14925fd44b2dd3a764ce148f837f29218e7c2253dc6b7d12133ed82
MD5 c32207951865b0bb87f8b7d2bc5df929
BLAKE2b-256 1a3bba154fd4c5e9ca5b7c95693a6b2533f4f27167649a400c8a4c55189dee47

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.22-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4b1dc7b994054ea9f8022b2b7cf7be615977f823d9183830bcb6c60a21c9164a
MD5 018d8473eebce02351a3ebdc3b15c443
BLAKE2b-256 f67de5ece352871f6395fa9d72167d33f6d1e76fe3b57ff943c50da569cb824d

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.22-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1bb2673d5c4a2adcb87b730fb6a01f4d45984c7c14ea762654fd50aa0459ac80
MD5 ab8d3cb654d66ff78911a7f9a86d758c
BLAKE2b-256 3a9ed9fb001e71acd1f38e888b6363a839854657e8864fa52d938c8e3f5efdf5

See more details on using hashes here.

Provenance

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