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
├── conftest.py              ← pytest fixture (browser session per test)
├── 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.26-cp312-cp312-win_amd64.whl (1.6 MB view details)

Uploaded CPython 3.12Windows x86-64

snakeoil_web-0.1.26-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.5 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

snakeoil_web-0.1.26-cp312-cp312-macosx_11_0_arm64.whl (1.6 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

snakeoil_web-0.1.26-cp311-cp311-win_amd64.whl (1.6 MB view details)

Uploaded CPython 3.11Windows x86-64

snakeoil_web-0.1.26-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.6 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

snakeoil_web-0.1.26-cp311-cp311-macosx_11_0_arm64.whl (1.6 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

snakeoil_web-0.1.26-cp310-cp310-win_amd64.whl (1.6 MB view details)

Uploaded CPython 3.10Windows x86-64

snakeoil_web-0.1.26-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.4 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

snakeoil_web-0.1.26-cp310-cp310-macosx_11_0_arm64.whl (1.6 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

snakeoil_web-0.1.26-cp39-cp39-win_amd64.whl (1.6 MB view details)

Uploaded CPython 3.9Windows x86-64

snakeoil_web-0.1.26-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.4 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

snakeoil_web-0.1.26-cp39-cp39-macosx_11_0_arm64.whl (1.6 MB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

File details

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.26-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 dda578a57b7b8063cfe2c11a44ec4c976a07f8a1150f86097025018bce0780d9
MD5 3a2f299290efc59a6050e31aa055d560
BLAKE2b-256 ca7f64041476274f4df65631d333da278105704cd4e6bc6afe92f25c4c2d95f5

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.26-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9d4cfc5a99171aefe4d79f579a6b5ac368cf0eb1b065a09c00eb9994566e744d
MD5 650f4f952816676c5c2190ab1e2918b4
BLAKE2b-256 5c33bb4be1a6bb5d319fd087e3c49664a79707ec32b0a22fa7e2623c21770c4a

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.26-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c095f671aa40d664c6802d91f12c0c7d278a5cf6369bd7b1abf25bec5c175faf
MD5 a695bb7a0961539ee252a0c80399ebbd
BLAKE2b-256 c2a7abce8b294c465bcf5921edc88649c32e5c77cbbf7783c833e57cedfceb61

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.26-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 255db23b3ee9f71b4036173c02f4ac36ecc8c2e612a6c326e564ae1aa91d2ed5
MD5 93c23603172dfc0df1fa2a5f7702e766
BLAKE2b-256 0e540e70a414c0350c2ff3c2acc4126f0437948bfa3d88016ccb1648f17bfb8f

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.26-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 814e044354ba6be8ab63e89868418520a975be46119c22c88fa2aa20eac77000
MD5 fee36d21c783bc35ed0fdd397ba8274d
BLAKE2b-256 e24f37578793a86cf415f696ff92d5a8ae74a2d25ec2c3d92c9f28f835bbe653

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.26-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d44616f5824e0491f5b02a0150be54610935b48a3ac909d0bed9e1e26bf9c5ff
MD5 131bf1433dd4f8b7eeed7f19e5a6f018
BLAKE2b-256 1fb2e875b4ef0ad8aa6d890800af133992e923e0bc2c869bb83fb184a21f1420

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.26-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 6edf7382b2cc6e878e0de115218d5100f4b29b0ea8edbf1ed4bdd689e68d6e50
MD5 e9c7d19cb311f846aea9a0096dfa8209
BLAKE2b-256 1abd711f51f63e661a3cc1788272f34b30f7fb4fe09b9935d3f36eb226f724ef

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.26-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a724020665f0342e31732bca53b929f0d2188a513c5d89da3491ec7f32e5259e
MD5 2f66a0b0f85e410a145c6996b65de702
BLAKE2b-256 8a5016d72f58f727b82624b35fe80371d2c81b897059994aca59fed63f3916bc

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.26-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5059ccd969c473edd1a86c2609731af4debbf98d635a4c27d61f993e6bf22d16
MD5 173d7c203a87fa08e1add77795c75f62
BLAKE2b-256 c6c29550c71d346a3b6b61d2fd4c6636dd8689a4f3f8d5a1cb778b6731d02ec2

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.26-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 876d70d8684fb5d7cf27f7f6c4882da23873339baab97ec161a8d515a4ea4db2
MD5 9d27009be589acb93e05ed6603b2d2d0
BLAKE2b-256 3aea33ecbadab415ff4843beaeb75d0a486fb95bb9d1befff09e14ff91e8a231

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.26-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ccd6a4fb04817d023979563e4a79d99ca26fbf20c1f37ebaa8ea72e2a0801eb2
MD5 922e1579a489d93e45167b7447b66d86
BLAKE2b-256 3e90d2b2f8acf42acf14ea26e5c50ae01263d462f79a4fb349d1c7cc4c5bfbe3

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.26-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f93fcb532715675a14350b9a7a98804225f5588a554319a33c4f0e63b2ce06e6
MD5 67d43a8b4fe73d63d2c01e051ae67215
BLAKE2b-256 cc1a8a42d185ef896c3f579c7ef330d1416688c27f1b95fd336f0db91b048f2f

See more details on using hashes here.

Provenance

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