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"

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

Uploaded CPython 3.12Windows x86-64

snakeoil_web-0.1.30-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

snakeoil_web-0.1.30-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.30-cp311-cp311-macosx_11_0_arm64.whl (1.7 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

snakeoil_web-0.1.30-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.30-cp310-cp310-macosx_11_0_arm64.whl (1.8 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

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

Uploaded CPython 3.9Windows x86-64

snakeoil_web-0.1.30-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.30-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.30-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for snakeoil_web-0.1.30-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 ec70f45a86fd5fc8493c36c457595fe2d29113d77c74bbdef71e9c15f1f222bd
MD5 d8ca5b2ffe5af07f67e4ede14a261093
BLAKE2b-256 39f337a2db1626a4de3c0854a82949e9c5ef437f39443eda4663bde6f18e067c

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.30-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1baeafe3a7c3e0a9aaae2d249a73cb5f56ec919606c42c08f8d2215f392c0e3d
MD5 58a9f4ff1f3393030bf279de7778c348
BLAKE2b-256 dff6a7fa4a433b4c866f3356d10956294e808fae931ff93e1262dbea3356ca7e

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.30-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 bd46858444363b11b32d57479b7ba14489bf6cc6824195e4cbbc61cd8b061299
MD5 b40adeeaf3f7ab97c6c6384669190081
BLAKE2b-256 f3d9ade307c4f4e3f540d7c322adaeee1fb4da336ca18148db86a8b727c1401d

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.30-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 45dc0834594223bb917d031434e63de69498bc5784db31947559c96c7d294abc
MD5 8927c712576b6375677e1a714f73d325
BLAKE2b-256 5f63995662342509cb6f8edc21ff9bb1406f06293fcd200a66bddadb0658860d

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.30-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f72fcb82ff4f40f84fc08d9d0cf28df35b444bca550fea145f3e3737e5a8d4dc
MD5 6239a8b54ffae9f1eee8d3a54cabe221
BLAKE2b-256 067d6de0f39db6a4fc1909588c31f2674c8371e797be2bc630886b90a9516ee7

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.30-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7329e5b13edd7af109daab236e3d11201dcd9a55c1ade2f7949ce12f261fc0ab
MD5 566194ad8652fbbbcdec9535c5873e2d
BLAKE2b-256 6640143ef4168944e012e7e40b1b76f8797644e080c0894ed56546fc8969195c

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.30-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 0498224a039e2e0b63942da322a7d5f3d10d9d3ff822e30c0a9139e51aee4cf0
MD5 a2425ca5d1a74d19558dec39663e60a9
BLAKE2b-256 9e3f57bdded3674afef9dedd60d04f893acb26189cf104a0e160f5e989d4d218

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.30-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f6695d4f86631249634c8d67cf4ab037328d65773380a6d2ca5d1ecb20ebd6c6
MD5 55c8f37b42ffdb28513f46d0a3e1f8f0
BLAKE2b-256 6a1a1ebbe9b611cb57b1b9dc942e6f6fce18e35125303dece40c46163ce797fc

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.30-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 da9357c725a272e821b724e63155cfeb3594ff533e42dbf86daec634e01fc4d7
MD5 c72d1e7b3983e8f3755da678fc8f17d0
BLAKE2b-256 526185c863a9b69ccdaede650d9cd808291d3e545a3b7474e37274f06400ecad

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.30-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 6bfae21ff634f7008cefc754533758ccf0ad60cb5e31075603af3cc269d7739c
MD5 f96a70211494a3b3445418e8fdc343e1
BLAKE2b-256 53bb6588466cfc22eecbe1fb1da75c05bc9fe6a56e2417631eaa021e46295ae9

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.30-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d9aab7f05465fdf2495d038ec41b36a744366d65ffc8d322e952dc463a62ecc4
MD5 2cdf1cbea69b28610ca64f49cd21d7df
BLAKE2b-256 0ab93f6c332bc7d71492e0c7531271f649cf85eac08cbf7f7c895f7fe8b3cc60

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.30-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 06b8180b34b73ee3caead837bf9a497681dc20b2167361affdf3700c3ae00edd
MD5 37dbcebed51069a03b879df141cc75c9
BLAKE2b-256 5e387a4d731dbc4f886715e966ce6874af9e4a0e696a640a594a096ccd27b150

See more details on using hashes here.

Provenance

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