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 = 10_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.41-cp312-cp312-win_amd64.whl (1.7 MB view details)

Uploaded CPython 3.12Windows x86-64

snakeoil_web-0.1.41-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.1 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

snakeoil_web-0.1.41-cp312-cp312-macosx_11_0_arm64.whl (1.8 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

snakeoil_web-0.1.41-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.1 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

snakeoil_web-0.1.41-cp311-cp311-macosx_11_0_arm64.whl (1.8 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

snakeoil_web-0.1.41-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.0 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

snakeoil_web-0.1.41-cp310-cp310-macosx_11_0_arm64.whl (1.8 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

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

Uploaded CPython 3.9Windows x86-64

snakeoil_web-0.1.41-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.9 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

snakeoil_web-0.1.41-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.41-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for snakeoil_web-0.1.41-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 48692d270435b6d8b637a4ad35efb2fb6dd1e87ff46126884fd8631619170355
MD5 fbc2174a82942c1bff0b4bd2574a98fd
BLAKE2b-256 99e56821a93f55409b32345c1a80e5004a008fdb48d426e3c6e0f03ef1792f85

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.41-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 41d5f7b8d0a8ce3a7505043b9d07fe29382d05555f1acb5c6c29426007a95911
MD5 50ce223cb1445d806f962fa0b1feece9
BLAKE2b-256 69c95c27ea96c35de0769ac68359c938f853785d1d55fefd63232db690e4a3ce

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.41-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 165ed7dcf28d71a2f56e0a5db4aadb306d73a36c89924a3120dc7c7efb4f0fe0
MD5 53e7f141e6f1b48edf593ac50eff6731
BLAKE2b-256 d03683a3f9672357b166158f9ae7aa9eb74ec405ad42c48d867c30daeb34f964

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.41-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 0fe7b861dc78cd53fd25dd6b630356cb27333f3c6fb3ed34c385e11a265b5a1b
MD5 a4d2a8194e738b73010c01e098201ea1
BLAKE2b-256 9b21bec9ebfbb805d989925d1f216ab720d60ca62d0c34594b111b3efe529bc5

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.41-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 067bc3de103cf66cf1fb858b7b0a47add074eb9c6240ee92fdcd5949502e4185
MD5 d76ec6485bf1fe7e57b070628e4785ad
BLAKE2b-256 d9116e25ee4c453ad6259a5531747863f3906842229f2b5d0b78cdf31b36bd35

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.41-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 94471de7390978a3e0d163db31ec22244f81649c49b63071060715b1deb746e8
MD5 49d79baa99e9d33f311e03d6ebba6b74
BLAKE2b-256 89e4263e91bb4c7d47e67109c40653e211423f50c71bdf4e30eeb8b8355c1626

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.41-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 1b0e134e247da06e125ffdf2b2360c24fc17181744fd202953bb7f449aa3b677
MD5 afe30540b2acd522a20a3a10acabb984
BLAKE2b-256 a00b85a0f9ee31aa8a14fb2f7f0a22cc64a3cbe3b676b66f32a334078677d4c4

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.41-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a21c622ec4651148ebba42f139f2e713d07d3f5e653f460275e1be0a693fad65
MD5 22edb53f8bc779958a5642153521a49e
BLAKE2b-256 eab9da97aa221dba94db284433214df82de4afd830be5e435e36fa81646cd437

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.41-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8af7f570dc0080075b8f2e25618848089c51d765455958517d814bf20dfeaf08
MD5 3de0295e74ae02e76dd21862a41003c6
BLAKE2b-256 705b362b2800d4c7af59630de033ae82400b080a1a4815c943b05b9d54b0aaa2

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.41-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 0c95614c2085f7f8a5847bdfbce95b03491ab9e2d943ca50186197649ad73a77
MD5 f4e7c1f188bf208d17dbb80d95ff702b
BLAKE2b-256 d36cdcc96f3a1dff82a92f987085830e2f2c59d31cced515c98cfcdd32f0f2f6

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.41-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 cefa83321e0cc85d071d6f456df8218d4c9ea17b21d98888e4f5652adff856f6
MD5 b853c372889789799dea54006da1e6f9
BLAKE2b-256 9465b2db2821237043a3528b75b87db75c1884d8201d2123b49440e3289d9dc5

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.41-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ec2a67eb6f5d5eb02626cded5ba72781f88a07f45566acb9ab2782c40ef58e55
MD5 bd7e1c40a77dfcf78597292909cb7e84
BLAKE2b-256 647817b32becc771e5192781353ea96ebe51ef866cad9b5bb726d490b1f57612

See more details on using hashes here.

Provenance

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