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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10macOS 11.0+ ARM64

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

Uploaded CPython 3.9Windows x86-64

snakeoil_web-0.1.34-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.34-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.34-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for snakeoil_web-0.1.34-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 71ac3c30d06b37c574bf9051c04bc7deb4536b89a22b9f0020ed1054d404602e
MD5 bf8695c5f68cf10d7164ce92ff36ee19
BLAKE2b-256 6914e11f1d6e7f7944cc901a968603aaf766aec9c55f5cbf115374a731cb4956

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.34-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ce67b3a9cb705a3dbd53c41f304eeaebf2ea33f151156ddfbd7ab93e0fce66d1
MD5 63869bd36c930d08a2db476e1ee9ea3d
BLAKE2b-256 6d379f785d8ff9b1767e762fbf41818e1a39f340a1bf5e4c358f200ee03b3493

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.34-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 889a4a20866f5f042b2e9249ed134771de60ed13797effe3db45dad3529b49d5
MD5 e341440b95db822ca090487b27134717
BLAKE2b-256 c8170407e9afd955c246f867110341a084e2b5ae13bd430e4d38f92cc6317803

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.34-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 3cc6c6a3447a4b12986a46852a6c4af1f5c2eb0a05c0ffe2e31e6f019ffa925d
MD5 86a9351506eaa60feee9b40fbd3172c7
BLAKE2b-256 8ec19aac8fc582887343f7139dc2a8caa9bb0f0ee3bacec8e43fdb37ddae1cbd

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.34-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e85baf85b4512ef2b025c93f30445629d24f3f1c00eb9368f65ffe7b7ef44cd1
MD5 006285226a1a65a51d9645da21c422ba
BLAKE2b-256 af6d2e43f3d06d87875000895b14b6af77244df2cbc77e8a70d9185c0d9768b9

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.34-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 231e2a4c5e12e4f1721dffc8b38eb70c6872943ccefc3368aa2abf0c8ff7133b
MD5 0ff7cd046638996cbf96fa08a9dd3488
BLAKE2b-256 437fd6448730b4ed932178b3ffe1e78ba68bfa6c6c7f2a1575ffbc64470ffd26

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.34-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 2f5d06d5d7ab151c514faca72f38d787044022aa2fd9b15b82d630de46dadf9b
MD5 13545664d94e80340bfd46690b083306
BLAKE2b-256 8d1008985bc528ed742cf0625c35bb2d0144dff0d6d71102dfd517d889610a37

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.34-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e61787bee65613d9d030e0292241778fddc74b55a9810ac5302d7cf820b35c28
MD5 a8a43917f916e555dc60d5ba5da65045
BLAKE2b-256 e5865bf17ac43be1863af4f3a4afc321981a563ea4a4252343c223681cb84b80

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.34-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 dd73a98f51ff456914f38ba661002d221137a946672eae6562c2921bdedf4bcf
MD5 ddcb812235ee58f78c1bd088768bae0c
BLAKE2b-256 4ace91609b81241af1e9891a3e3b22a982a2b1984c8f68b690bff3f685a5183b

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.34-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 b23013fb56bac2735db0d568f95070876514fde2777168fbf48e8d3620708e45
MD5 b03c348874c374bac229dc7ed0ae793e
BLAKE2b-256 162866129019cd30799e3083f0435abe1b874a6f774a7e7555e98b58fc650bda

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.34-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b8668286f6a2cdf7708eee04f77beb52d248b039c842b5444a31ce642878d4b5
MD5 057ba400ece3edb85498a1c5731b3ee9
BLAKE2b-256 5dbe2e4a6ce39f7501da7982d702a1bdfc2989687ceacffca4fd94a5cec4f683

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.34-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 709998821f26105adc92a6f7e4c00f37066e6165055405f3bf6d06cbacbdd546
MD5 640cdc276ab9b2f3fba27ce716a49e22
BLAKE2b-256 eb7c5b18a70553a6879cf010ead01e193852ff2c16fdae4c1b4b7b5fcc515d49

See more details on using hashes here.

Provenance

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