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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10macOS 11.0+ ARM64

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

Uploaded CPython 3.9Windows x86-64

snakeoil_web-0.1.35-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.35-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.35-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for snakeoil_web-0.1.35-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 b589e83eef2e2d45b47f3d8472455f73d0b71275d8829c113e5725ea7806b9d1
MD5 d878fc0d69255fc103a1156f4a48c558
BLAKE2b-256 d97a190e0ed816a33ff0b6e196e4c15d519df20f75cb6726f272bdf3ea4fa731

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.35-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b8eabce03446478656eb561997a6bdc4ce5cfbfd545debe6d6c4ce52fc372834
MD5 7533d4c25725c4bc1b91d5594186cdca
BLAKE2b-256 a63bb7fdcb1a9b0aafcba86713267ced2fa5f5548b60bb9b3038e886d9553567

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.35-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8b0a981a110d05f7af9a99a278f23d6b4ce45e801d5692486a42a0c95a37e461
MD5 0ffea368ad8810fa013106dcc175edbb
BLAKE2b-256 42817206f13cd744e83dfdc59d34b1932b378a6fe30357e4db56ffb5a997b9fa

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.35-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 2ed3b14d8aea3af8bc36ec01b525bde076748e53c46026c30f3ff2a17af97f1e
MD5 777aff643ec5fca03f319dd83b142f68
BLAKE2b-256 6c9a10dc40329b6fd6950d1bf580ce5af130c3ee8c370f55946338d89bf2b929

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.35-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ac260bbeb76c236ba92e458e3de8c5f8ab85e040a79d9fc1623096604c0ace7a
MD5 034afe2714a8758f77ebc8a34c456114
BLAKE2b-256 748499107b14a17b0e01a93037dde1f45bdc4dd6eda2bb9532d3a9a64d0b99bc

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.35-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7b401593309baeb99bb584d5046755e6af33dbc7fbd9460276000f921657f13e
MD5 f6d45e4ef175539c74f43e2d515ad930
BLAKE2b-256 ad452521846171c0fda235d64fbe66f83301f2915c4f5b32710372e080df44ff

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.35-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 7e679e1ee6331aaf0210f6f5522504a54c0af51b89290a7bf387078e12232beb
MD5 010e95511139560fd54a26344b67e791
BLAKE2b-256 d03c2acbb2bf99d12635574541c7d677df5fd8e279105d2f54afe908d827929f

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.35-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 fba4bfb48ac817ac4a75419c5da4b2fd7a3bb828da986b9b0204fb0ab84e50b4
MD5 ba4b0278fdac7c1506d5977d6051e0aa
BLAKE2b-256 25b559539db2b471709d63aa3733cf13955ddf6bdcfcf4f1ce832ff946a0f170

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.35-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f42cdbe1c3e7a33a925f7e02e1c75826edb4b9d4ac42b09c45cffa6f8501de5b
MD5 03ae47e0719bf98f30042acda991d0ba
BLAKE2b-256 4f0d0847368e7e2d2c1740a399b66bc7f1ad4e4aaf87764fde2b3eb0bc0af801

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.35-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 36fd702cafb81aa24b62f73568737b21b824480e083935dd049b2db61f513668
MD5 2a0eee4269172534a97e2970ae3c6d86
BLAKE2b-256 e14a63e0b957758c236448ad2e899be4d4bd74f6ebbd280ad568bebfe90a9e6a

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.35-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8fd0024cf064ad7ca9681063c8f6f250cb79de7731d90e369fba9decd833248c
MD5 c361492965e53262c6c48fc5a0d4e91c
BLAKE2b-256 d0dbcaabbe97af9fb3c6f2c3eeab2afed88745bf9fa5be21f6d61dae7e1dc702

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.35-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b50d69993961267c34a57e1333d6106a39d56959237ccb0262141788bad5dedd
MD5 0f1bdbf32711d95454e471cf049ff7f2
BLAKE2b-256 e2287ead644244babbc421c202b30803ff4e2d9af07b29a1252c5d67c60fa32d

See more details on using hashes here.

Provenance

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