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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10macOS 11.0+ ARM64

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

Uploaded CPython 3.9Windows x86-64

snakeoil_web-0.1.33-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.33-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.33-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for snakeoil_web-0.1.33-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 aaf587f06a6e72df55169fd7486b19e3ead168b67e83aa563dc6e8e05642cc8e
MD5 6ec8c0cf6f5258f949cae270c59d2ed7
BLAKE2b-256 0242ce174089d0dcc625eda6c86b7ee2ee87fdda79268902b462b22d86571993

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.33-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7e1ec87b6436239858a3b4b16071a5f5de4abb614dbfd93013c2cdb03ecc4514
MD5 cd64e71dbe67827f9c37cc1017bfc572
BLAKE2b-256 ebe418f634156be1e5a09f2ee233d3cd919dece8d7d152f31315b394de25d71f

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.33-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 fceadc0ec24ad9ec8f81dba89d74c12a4ff9237be0d44dd25957f85cad365b56
MD5 d1a5ade73ea92b42a2c29e9f1c133000
BLAKE2b-256 9e77b051f701212e1761c3996eebf8b63b6d708a0ce8c2922b18656a150000fd

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.33-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 20d17a2f4dfa8db19b79efbcbe869c39403b053a1e2943349c565fdfca530249
MD5 469dc734d4cf5085481c418e21159d15
BLAKE2b-256 3a1cf7d69a547fd6becbaae8a67d588f5c93cf39007f40818bb1013b21938446

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.33-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 84ac64bf30b44c1d87cff7cd8557e7235ab0fc7e8c7accec552bcf820f910783
MD5 264719502224a4771b68eee5abbf13da
BLAKE2b-256 a61949feec7be2ac339fdb92253dc8d7cf537db32a529a8b91c1fca0228ead83

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.33-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5b523739f5b2d7b2c3e36da70ea608fed0320b82dcc40c28e63bb8cc52c15f5b
MD5 b0521f90ce06dbf6e0a51dd855302f2b
BLAKE2b-256 704601c2f83df35aa11e4c1837eafa6613488b659fa1cc3b26d39aef1687ff3d

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.33-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 1e2dbb7630b31feefc16f6078570a6b863b3b00e4c347a52a6ac9b7b199b6b33
MD5 645c8e1e63b7722d684bf84fb5fb1a88
BLAKE2b-256 bbfa97cd04f4929b708a2625e66ceec1d5b8d0f1c60ec118e6442cc7c104523d

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.33-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 26b22bdb5989a671326536c7da2b2542b3760da4bf8bcd3a5b01d324cd4c3a57
MD5 279a97cbdcfe9c1fc57a5f7be63b9227
BLAKE2b-256 963888b7a790e88a8b533b3c31d650840576ec19c097d3687a7726d456d406ed

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.33-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 83c936cbfcb117e304cbfb9717035cf0d7ce02d809ec71bab73c05ea2fd925a8
MD5 ac11c9d851c418c3948451680101673f
BLAKE2b-256 f50bbbbb48c1d57b2adc1510cee10ea1efe23ba9e10b4df9aa92b939b450eed1

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.33-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 98dd5655a794458104e57d6aed929c15e2fb2726cddfec6eb346052c7c76419f
MD5 4b2a68690557ab58a4e775c7d5600623
BLAKE2b-256 7225e12149e4fdefbf7ca5a3b048c1d3e86e634e48df677aa095367fb6aac2eb

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.33-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 bd2ce4ab75f2b638ce7ad669f22b1d77ee30ac1b2d40f44492c06f355cb5dfae
MD5 094988df1aa4c31b4911df7042492138
BLAKE2b-256 2df534a3d77277f862e5bed20ab6160c71173cf55183929d56e9fea652caf761

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.33-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6e24310682a5ce32c3384482ceab2a3c855d123c8c5cdd886a69d1a3b0e6d028
MD5 e80db20e6b5ab707af146dbd27246f52
BLAKE2b-256 e75fde2ff18032c5b4cd649ebba14240181e9c175028169678b4d2d00498a747

See more details on using hashes here.

Provenance

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