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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

snakeoil_web-0.1.29-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.29-cp310-cp310-macosx_11_0_arm64.whl (1.7 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

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

Uploaded CPython 3.9Windows x86-64

snakeoil_web-0.1.29-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.29-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.29-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for snakeoil_web-0.1.29-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 101a9182e7699688445c937c9158695bf64d94360b6bf8c7c043934e13fda18f
MD5 010df4a599b0b6be2a0ef1135bd0871f
BLAKE2b-256 7623ae2eb691618a13bb745df7f21e12e3825dc44f088a411b7cf2b91a24cd73

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.29-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b65d6040f1dc182ef3e39a3235b8c8bfd002e3c6bf234ba5c4abba2f981fb570
MD5 3283ea38630c6bd0d050cc7d5797ca5e
BLAKE2b-256 3fc7fbcddeacc4f7d482fd406067fe5b9b627eebe34a716e05dd1a0f5a788c9c

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.29-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e420352633096a89186d074702a0f5e30e3db72e1cba2af9e7943f28684d8265
MD5 af83983a7a86068213714050c23964e1
BLAKE2b-256 25425ba9458677eecadcfc81fa6f56ac001c72c419eb0bbfa9fa553c8b6c1414

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.29-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 4ed862a0f5434e59a09f0e6e7868ab58878b91b0bd21e7882f2fdfe2f7a8d1ec
MD5 b461844f4569eacbf08e8e30adf97812
BLAKE2b-256 1308dc7f6f256139eb806b3d622558aa918c175bc9dc92aa20e590ba71b268c8

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.29-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 463c95dfacb1c4c9d382e7be6e4fd71b7b1b80ecd773043ad2e679300f55dae5
MD5 b45f072e05d1fa6f15818b5ed99ff96c
BLAKE2b-256 e0be73ecb1e7d6324b446765aa586a952e5f7a632f4fb384127d1552d461bf2a

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.29-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9c5bc31799d0650cdff3cfa5affdf784dfc28837f0e6bac2b37d223ca7697ff3
MD5 7ba8b211b8334473c687e88a917ce1ee
BLAKE2b-256 38dbb5bd60d1c193e52ae374e197218447487bcf607caa7841cd120ec1d5cbaa

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.29-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 a2e31bc152eff028c892dec351b4e3b49c58e955381667f68f0a873ae5a8944a
MD5 98448cb87e4e5ed324f5808669d915de
BLAKE2b-256 22bbdb680e5cc61e512c18248d0c293a4fc58277428d69c0476ed4f63a713718

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.29-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e3c91adf989650280c636cab1e91c2a9d19cd7e99e9214c5cdc4b5ac78e21724
MD5 e676836a91c187e2fc325940bfadfb46
BLAKE2b-256 3ce2f5771a044e4678c3624cc343ff0f66126719603e482a2ca16d0c4ce56c83

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.29-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 abf53460b7b45f942a56dce91bb55a020bbc7588c56b34202aa9991fd46269a0
MD5 e0537497e7d4ea974459a6e1462679c4
BLAKE2b-256 c7dea5bbec925681a716fa192df5f0f33fa62a39a02ece39ec03a7102ae4b088

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.29-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 a2b4f7a6933bc4366338a3c401ccf0838f9ad6ffcbe8ce3f6c9f5cc5b708f2cf
MD5 5d460da87e2113ebe8cc3351b74ea768
BLAKE2b-256 f6d1e2008df7f8caa44ec8826269fb6e737ea5f5bd00abbf72634bc90c175d61

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.29-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 aa3af8b6b3685e76aa83e107fe029e2bd7b84953e57da21c598b987e690c5be9
MD5 b0f6cb811b0bbd51c2a48c3992cd7663
BLAKE2b-256 87f810955c5a41537b3b849412e43405ad5e6b6e07574cbdd5dc0ef9e66d9dbe

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.29-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 514270e2494c2f12b1b25b3532df1297d50e1b92959aee709b0778d00e276cdb
MD5 4bb6bf80f4d9307ad362ba112e67c608
BLAKE2b-256 ebc77d65b8e6418b098f09d6b099a9acf11f0f86b796da50e9fa27f013f07eb8

See more details on using hashes here.

Provenance

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