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

Uploaded CPython 3.12Windows x86-64

snakeoil_web-0.1.27-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.27-cp312-cp312-macosx_11_0_arm64.whl (1.7 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

snakeoil_web-0.1.27-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.6 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

snakeoil_web-0.1.27-cp310-cp310-macosx_11_0_arm64.whl (1.7 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

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

Uploaded CPython 3.9Windows x86-64

snakeoil_web-0.1.27-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.6 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

snakeoil_web-0.1.27-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.27-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for snakeoil_web-0.1.27-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 b5c6061d78696ae45f94c62b792ff383717822e17cdf92cc8bf0454e22d6a5c9
MD5 1eae105525f8eb6dd179b5f48164be42
BLAKE2b-256 2513acc6505fdca2d773915f61e70e626ba2752cfde0156721c560cacfda63c1

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.27-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9618b26a6c829784e59c7d0e2bfeb14f4d78062849f7a92952fcc861341e6cee
MD5 15e707860cce86dcc7b9c7f349c42dd4
BLAKE2b-256 41772688afadfb07fd895d519980d36e30fc5876788c15883ee8525ece3597c3

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.27-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 72cf84c9f407924b7fdf205d8471059d69cacca8c8f8b2de2900d90ad42af104
MD5 5eb1dbc335a936927cd10b846c4e9696
BLAKE2b-256 246eacd0da70f9791b5f612eaf5327e59bf79fe0896d9c60df619dc5a19e275c

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.27-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 8b9d1a5f9ab76f0c239413822b95cf4c9a7557c9b8258cd0450688445c6b0dc2
MD5 bfbbfdd04d23c8f209ba16add0af77c1
BLAKE2b-256 dfd072b49635e797afc9354cffc320674d70c90142740371b023e20074261d3f

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.27-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 86e910708183d3096702da4e319decf3fded321ee3f58e86476e24b33a39c1a3
MD5 fb0d4911845d3da0cc302f70cc002209
BLAKE2b-256 1032db21579f8b2bc994f523ba865b4910d4df1b13eb44206fe52b0980462228

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.27-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 097bb730d3131d22b7f287f3113f204bd4b0e6a975b4573bcbb15e024741841a
MD5 e924ed4108883c20b7119ee62c29c7dd
BLAKE2b-256 80ea08b40e45ae5fe9f5c56f32cde3ad0924c48d81f51a9c11e5ca9f399379b7

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.27-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 7e7972bdd49652bde58221ee265df01d69e8446f789ccf020af29b424b2af014
MD5 712f80cbf9a69ce8867c070cc413f512
BLAKE2b-256 83f52c83e959b426e57497f9e9cf81bdb1f1fe878f2d77337dab77cefb99b0ee

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.27-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4c74faf1852b2c1c65dbcaf805a669f7653b411c9b789d81e6004f7ffb212895
MD5 e9ba4b9f9dcd19df3240e69ef5e72301
BLAKE2b-256 6cbaa9a432ebda53750acadbc41f29398112f505039d1d9e81ce49f4b798e6f7

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.27-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3a157ecaed1a04d529f19437145cc7e95d4a722b6d35c43a96f0c4da69dd3b52
MD5 b5096b095e1a048092b307e4cf386d7a
BLAKE2b-256 0e76289dec3a6c9bc00277c053e4026cd78771b989dcd91d8de769c2f485deb5

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.27-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 12b54027397f210836ef8143d4b1323d68404cc1943903b2e68ed03c3fab274e
MD5 407b2a65a1dd24c18bed1d17515c1411
BLAKE2b-256 ae45ff3adb4113f3b7ad1f789487218720b8dd85e9c822e5dea444acb7b59dc3

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.27-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b1372c484e51b0dbb856a40d9c9e82bb07f6f8f2402986b261af023a75715247
MD5 a503354edaab875560ee4541f3d47933
BLAKE2b-256 744c3daa505a81872eed3b0eccbf942c98f5aed6d530524650051ad48ae48d34

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.27-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e31b98200caf1d1a1ae491e56c8eaef64661473db445ab313628346ca32efc36
MD5 d0ef563911f595592693729ec2201be6
BLAKE2b-256 843e69e9806a3dcc5c54bc75bc57b52d5ed60820ebbed70f50b265e68922c834

See more details on using hashes here.

Provenance

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