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

Dependencies

  • Python 3.8+
  • A supported browser installed on your machine (Chrome, Firefox, Safari, or Edge)

Everything else — Playwright, pytest, pytest-html — is installed automatically by snakeoil init.


Install

pip install snakeoil-web

Quick start

pip install snakeoil-web
snakeoil init
pytest web-tests/

snakeoil init creates your project structure, installs pytest and pytest-html, installs browser binaries, and generates sample tests ready to run.


What snakeoil init creates

your-project/
├── snakeoil.web.config.py   ← configure URL, browser, headless mode
├── pytest.ini               ← pytest settings
└── web-tests/
    ├── test_english.py      ← English instruction style tests
    └── test_pythonic.py     ← Pythonic API style tests

After running your tests:

your-project/
└── report.html              ← test report (open in browser)

Configuration

Edit snakeoil.web.config.py in your project root to point at your site and set your preferences:

# URL of the site under test
URL = "https://yourapp.com"

# Browser to use: chrome | firefox | safari | edge
# chrome  — Google Chrome (must be installed)
# firefox — Mozilla Firefox (must be installed)
# safari  — Safari via WebKit (macOS only)
# edge    — Microsoft Edge (must be installed)
BROWSER = "chrome"

# Run browser without a visible window (True for CI, False for local debugging)
HEADLESS = False

# Launch browser maximized (ignored when HEADLESS = True)
MAXIMIZED = True

# Maximum time in milliseconds to wait for elements and page loads
TIMEOUT = 30_000

# Directory where report.html is saved after each test run
RESULT_DIR = "test_report"

# Capture a screenshot when a step fails and embed it in the report
SCREENSHOTS_ON_FAILURE = False

Two ways to write tests

English — human readable, shareable with non-developers:

def test_login(agent):
    agent.run([
        'type "harish@example.com" into "Email"',
        'type "secret123" into "Password"',
        'click "Sign in"',
        'verify text "Dashboard" is present',
    ])

Pythonic — IDE guided, autocomplete friendly:

def test_login(agent):
    (agent
        .type("harish@example.com", into="Email")
        .type("secret123", into="Password")
        .click("Sign in")
        .verify_text("Dashboard")
    )

Supported instructions

Actions

Instruction Example
Type into a field type "value" into "Field Label"
Click an element click "Button Text"
Click by position click "Add to cart" below "Product Name"
Click near element click "Edit" near "John Smith"
Click nth element click second "Add to cart"
Select a dropdown select "Option" from "dropdown_name"
Hover over element hover "element"
Press a key press Enter
Navigate to URL navigate "https://yourapp.com/page"

Verification

Instruction Example
Verify text is present verify text "Welcome" is present
Verify element is present verify "Submit" is present
Verify element is visible verify "Submit" is visible
Verify text next to element verify text next to "Balance" is "$100.00"
Verify text below element verify text below "Total" is "$29.99"

Extraction

Instruction Example
Extract from element extract text from "element_class"
Extract nth extract text from first "item name"
Extract next to element extract text next to "Balance"
Extract near element extract text near "Balance"
Extract below element extract text below "Label"
Extract above element extract text above "Label"
Capture into variable {{price}} = extract text next to "Total"

Spatial targeting

Use element position when there's no unique visible text:

# Pythonic
agent.click("Add to cart", below="Sauce Labs Backpack")
agent.click("Edit", next_to="John Smith")
agent.extract_text(next_to="Balance")

# English
agent.run('click "Add to cart" below "Sauce Labs Backpack"')
agent.run('extract text next to "Balance"')

Supported directions: next to, below, above, left of, right of, near


Extracting values

# Direct return
price = agent.run('extract text next to "Total"')
assert price == "$29.99"

# Variable capture inside run()
agent.run('{{balance}} = extract text next to "Balance"')
balance = agent.get("balance")

# Pythonic
price = agent.extract_text(next_to="Total")

Using variables in tests

username = "standard_user"
password = "secret_sauce"

def test_login(agent):
    agent.run([
        f'type "{username}" into "Username"',   # f-strings for Python variables
        f'type "{password}" into "Password"',
        'click "Login"',
        'verify text "Products" is present',
    ])

Running tests

# Run all tests
pytest web-tests/

# Run a single test
pytest web-tests/test_english.py::test_login

# Run headless (no browser window)
HEADLESS=True pytest web-tests/

# View the report
open report.html

Supported browsers

Config value Browser
chrome Google Chrome
firefox Mozilla Firefox
safari Safari (macOS only)
edge Microsoft Edge

Chrome, Firefox, and Edge must be installed on your machine. Safari is available on macOS without additional installation.

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

Uploaded CPython 3.12Windows x86-64

snakeoil_web-0.1.36-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.9 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

snakeoil_web-0.1.36-cp312-cp312-macosx_11_0_arm64.whl (1.8 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

snakeoil_web-0.1.36-cp311-cp311-win_amd64.whl (1.7 MB view details)

Uploaded CPython 3.11Windows x86-64

snakeoil_web-0.1.36-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.9 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

snakeoil_web-0.1.36-cp311-cp311-macosx_11_0_arm64.whl (1.8 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

snakeoil_web-0.1.36-cp310-cp310-win_amd64.whl (1.7 MB view details)

Uploaded CPython 3.10Windows x86-64

snakeoil_web-0.1.36-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

snakeoil_web-0.1.36-cp310-cp310-macosx_11_0_arm64.whl (1.8 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

snakeoil_web-0.1.36-cp39-cp39-win_amd64.whl (1.7 MB view details)

Uploaded CPython 3.9Windows x86-64

snakeoil_web-0.1.36-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

snakeoil_web-0.1.36-cp39-cp39-macosx_11_0_arm64.whl (1.8 MB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

File details

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.36-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 dac315ba1a432b79bd4bdf6b02b52c6cf210009c2a48b09256f3822cbc140f10
MD5 dc9471f00f2d30f78f5f69f15d6cdd82
BLAKE2b-256 991e7004e44dfa3f5c9005f36121d7325d70c20d62d2812f2272b41edda3306e

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.36-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b1a5821128ad4ce4212890f535f52ecfcc67adfff8d286a9d91ff2486230f2eb
MD5 41a22be7d3b48dba4541eb9a51c34d67
BLAKE2b-256 7ce6303282894f485a3569b87eb3bc13e2c5c2f5da42807d59a6303d7486d60d

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.36-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4c8bb8c48ad4525c112b34bb4a159e771340e1d230618e17d65b0e51e3960355
MD5 7243e79561cdd567cad59114afe3bbcd
BLAKE2b-256 377f3fb1cea560cd4667aed785fb1a89e129bb4573df918b95a022c15e6874fc

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.36-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 bf1b8ca55f17ed60e0d2709f93e4decdd7d4fc28aaaadb2efc4e93f4cd3e2127
MD5 9bf413e3cc3a4b0bd06f4ce977cc33df
BLAKE2b-256 00b6ad1c3a0f1fe7ba0285962ad38e566ab41a6a5bf98926f98122704d3fad9d

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.36-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e7e66713a933fa8f1afdea9139e2a8e2467864e451fb978a039d136e703fe71f
MD5 287bc03c4b012747e9035a25fde61eda
BLAKE2b-256 776fa83ce1163efd4a54b798651bf1e73447395f15267e115860dadcc91c0221

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.36-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 514f20fb7ac9bdbce6edabe75624dc9c1b942e7ea64369f1ccb49b4c925ea3b8
MD5 dff0fefa97d1d3a42b4acb5212142bcb
BLAKE2b-256 8a9591af9edc4ef6295558a960baab603c6d8305216ef9781fe18dbdf4e79f49

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.36-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 ff52d4a4c0aff30e7e5fd87a8542370acd137537068eb5b58ce5682fd6010bc6
MD5 768e5c7f1f5bfb0ab2f5c2c1a4b10ee1
BLAKE2b-256 5a987f31c349e913ca2e7a02e63e03fb4b59d7966312a3d36bb07bd625822905

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.36-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8b1dd0618fcf494d5f6da6fd3509bd3a0adadec0d06223f664f434b10671256e
MD5 503a870c9f0b4c1cca24ae93c3bf3ed7
BLAKE2b-256 b54add80f435537049151e48bc4582425f2810bf3caa1489a898173622d70cb0

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.36-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 090713f7597521f41a30045d0c06ead9e33bc6117fd51dda4cc731a2cdef0faf
MD5 19aa2ca10d2dcc6caa3214173e4d09b6
BLAKE2b-256 35439c4527b2f2bc9a78aebd5e1a82c22ce7990eafd100dcf96217c4e94dffc1

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.36-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 3c97cc9cdad7e94822ea03ee4e1b2dd274c8f27ebb8cb755d6dac02c2dcfe9ef
MD5 89c4007279853b24246ef5ad3340f60a
BLAKE2b-256 6686ca4ba75bbaa0273196712f0acd702154f1438fa582bf8ea9f1ff7b6225c2

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.36-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1a3d55bbfb967de2f62e295740b85b984f5995b509fd65ac46b2b4522599ea98
MD5 fea73fe44b97cf0f41b3f671c9647384
BLAKE2b-256 6c5e90a65a6b752e72206ef49fe8f05964a7d9369ce0b60efc367ceec6651e55

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.36-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 187360167ec89bc890a81236818b0d59965a8022bd3210cab3ec943da4aaf8e0
MD5 faf8958e5a7f724893e3d63fd4ea46aa
BLAKE2b-256 b926e82262abcd70cec5f4e0f04cfe0e9cfdf3d8b44f1110d7bff588fc4c176f

See more details on using hashes here.

Provenance

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