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

Uploaded CPython 3.12Windows x86-64

snakeoil_web-0.1.39-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.39-cp312-cp312-macosx_11_0_arm64.whl (1.8 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

snakeoil_web-0.1.39-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.39-cp311-cp311-macosx_11_0_arm64.whl (1.8 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10macOS 11.0+ ARM64

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

Uploaded CPython 3.9Windows x86-64

snakeoil_web-0.1.39-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.39-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.39-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for snakeoil_web-0.1.39-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 3dbb42571fa1a2c65ffebe54198d3e981dcb5a7f1b5ad9b9c1157a58209bf014
MD5 a8edfa247a4d681db13b64d2384f85f3
BLAKE2b-256 4752c6c064d0ca610952dc5d85537771987d4daf30fe0b09a613fbaec5d3be65

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.39-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c62c74adb363a1f42d140d98ab3db162f4d931ca3355165d826b8a18af09ad7f
MD5 bbf69d2056cb3917510263116e219706
BLAKE2b-256 9df215c4eb1e778a7da5131742907f6beade3286d482ea8db5a3685d48948025

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.39-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b3ada77e0f887925645b780a3e67f24ca2af466fb07d9789e714fd7f4f510e26
MD5 621a20d155570b7b098e50d7328a7b79
BLAKE2b-256 ca31257b850791f807c43e13c90cf051d09c277b4a76b1accb4cd87aa2f4d209

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.39-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 b2de2e275bf7f18dadb976dbacd2e7a302186ae978e8b0104c83376880c95fce
MD5 1533d3bbd9f4b774df796c23588e7d3c
BLAKE2b-256 368ea4e600fc8dfed738d9ca6c500f20a903a010f7f2f274b3455f0d771e8b7f

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.39-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9f7a6c4e89d8bd491b35de6387ef4cbcd851bbf14d150dd434b2de60ffa185fc
MD5 deaef95e74e2f6322d38091cb7752118
BLAKE2b-256 d96b36a1d721bdc33979ea396e4853e2dd6be5d53673474e84fac483af8c3a54

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.39-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 248848a91bf9702945b9091178d84345e473e8ea9ece694b87d2c85ba26602b8
MD5 d4063c7c7d2061dc791f0178ea8b7f95
BLAKE2b-256 1443c8932a97bb6035c08416642e5ceeb4b8a9674e52a25719b1069ab8859257

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.39-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 4ea7de79e434400dfb170c5f46f53a85bdf5f87391be2d8f74d770e95e886450
MD5 d39397d4a3884b5cb618edf69219f58a
BLAKE2b-256 5eae734ffb85f9ce423c21a35ebf2ef6833f9ec3c5de60455037bad3ae5d9df8

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.39-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2f0284a1fa1c094b3b81fb8be9726eebd3ed3f5de3d7b060b66dc2e288903551
MD5 b6a63c1cb1bfc2b8893e177ff54cedf4
BLAKE2b-256 911f93ff2ed16e62ad4cb8a6cc99b7b363652d8b7f57a1677855873e150fece5

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.39-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 cfeace7a256df23f1c59dd4e73cab148132517142bcee990b38b9aae999790e3
MD5 5c66d6e12d159c2e1c3d4f7c32bd1b3d
BLAKE2b-256 b384c238105a1cc3f3a387118ed648d4a17b79e9d6fe4ee09a6e402f6d0f9aef

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.39-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 8d5033b589a3cfb1863e6221a4e1f3abe4820ce61b011ea896bdcac9b1392c52
MD5 4d4e507c8066195bcbadcefe2fe8a5e6
BLAKE2b-256 1c1e5ad383b2eb829e227874ee58754d514a84e9b883358c44326dbe13f11887

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.39-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1babb0a1d7b218d7b57ccb8742aaedf5c1063690dc73b4b2d21234f81cf5a66e
MD5 c536783f5e88df086a0a89f03542ef2b
BLAKE2b-256 c5678ac3d0d92f0484ab5b02510be091cf1e8203d69ff8d52484b13920735218

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.39-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e422274523340f69064d9f83af984196571e9f3a1c831316e8a1296fc56810ef
MD5 ffe69680ee404b700886811d5f820c8f
BLAKE2b-256 f2358d95ba5747639b0dc65d44e83a2eba2fb18df0a3293a702eff1ff8f4d7ee

See more details on using hashes here.

Provenance

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