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

Uploaded CPython 3.12Windows x86-64

snakeoil_web-0.1.25-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.0 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

snakeoil_web-0.1.25-cp312-cp312-macosx_11_0_arm64.whl (1.5 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

snakeoil_web-0.1.25-cp311-cp311-win_amd64.whl (1.4 MB view details)

Uploaded CPython 3.11Windows x86-64

snakeoil_web-0.1.25-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.25-cp311-cp311-macosx_11_0_arm64.whl (1.5 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

snakeoil_web-0.1.25-cp310-cp310-win_amd64.whl (1.4 MB view details)

Uploaded CPython 3.10Windows x86-64

snakeoil_web-0.1.25-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.9 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

snakeoil_web-0.1.25-cp310-cp310-macosx_11_0_arm64.whl (1.5 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

snakeoil_web-0.1.25-cp39-cp39-win_amd64.whl (1.4 MB view details)

Uploaded CPython 3.9Windows x86-64

snakeoil_web-0.1.25-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.25-cp39-cp39-macosx_11_0_arm64.whl (1.5 MB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

File details

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.25-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 9396c7774ddb81ff95f06a63eb0cf68c8279d84d1522be2675abe32b0b7b2850
MD5 d71243591ee44632f0c2546b6cbb4a29
BLAKE2b-256 aca9a301b351c214f2869153b0d30c6e6e762b8296896e08b39ce49f8b56a4e7

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.25-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8871c89be3c61a8a54b0b08677a55132613a4524e38bd2c88e5d7675a2d27484
MD5 942973386646b7f3a38573d40da6f7f2
BLAKE2b-256 d59f4039c2d616ebd11307b6c02740706410248b6cb4501e5583a668b0c26353

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.25-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 32a256ae324f2fd00a3b1e4ff80825e4bef5489b59ea2382ad25a94594b37dc3
MD5 432115bf8c06cf15049bf371500ca738
BLAKE2b-256 0b529c7f0f8e006123d47761fc1fa7c15bca7278e50ad1e16147adc13fec162b

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.25-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 b8a575167050788d94459524cc08bac55ba51e4184cec69a5cbf4dcecdca3ec2
MD5 6697308954dffac0a3b99b9a92175e33
BLAKE2b-256 66824545726b2e1d97891868263a6b108ac19d40b32cbebe29cc0ec661fd4187

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.25-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 684bafdccd5c906578d3b65161eee80d39bdc733d74df0f83e20484620784e7c
MD5 c85bddf999cdf68f174224adf4115876
BLAKE2b-256 38e6bad8bd7a41ee17b23cf2472ef605c4fc6f6f2764b7f734275a881de0b9b4

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.25-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6a7c7f2662ce9711ae7b17a78e685eb03406d0b64c067ea5296b9f2194ee9042
MD5 70c7f3d0225cc96088384a03e5a527d8
BLAKE2b-256 1fbcbe21fa448d4b81c78287e371fb0eaefb93c3e7c3c3299cac157803d7545d

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.25-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 403404e385534519ca842451ffb1dc596b7f891355e7ccb8d61440d5bf68ff3e
MD5 f30c259bd67c205cd53035a8da99d860
BLAKE2b-256 51e7a89efa421792fc5c119bc79d97e31c6c7886b398f40ee292a9e47b8cceda

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.25-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 59bb7f23e0acf934dee2dc9d9fe4d0dbaa8794d1de60ca622d2c729ab65f987f
MD5 747d904a30d2dd693a73f3e6d5b18873
BLAKE2b-256 8eff1f24ecb6650154460a3bb6cd55337f7f72bc5fdf2230dc6f89df558d7806

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.25-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 169912dae1da0b1d587eaf5b2e4bbdffda83fcd574113227f58ae692f97dadeb
MD5 b5ae02cc6129901970e2c9cc3b6d743b
BLAKE2b-256 db46185a557a4ae6d23fb923aff7c67b4345a28c80ce5871dd704c104fbf699b

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.25-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 9a6bf70045dafa0678133b9edde0e9857f96af9173c6fc2969ae5f2f40f335cb
MD5 b4f021b2a24a5f3878d84b84c948c7b4
BLAKE2b-256 00b2c3e9e9701d414618508d0f4f45fc0dd44edd6f284e4319191b9a51d9d7ae

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.25-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3297f54d3a3f188d8e109e030f52ab8fb98ecb86a65240c06af67030b309d0f1
MD5 f25ca27c4b81476919c12eb54fc7b36f
BLAKE2b-256 cdf8a329b226aaa44adce90b87cc22842535e4239666dcf2edc5776ac8980c28

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.25-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6c77f249d0b8750c2be339d880fd3554729d2881a86b2eb91e7c306f7cfde6a5
MD5 8fe94633f7a658220c32d15f4b117c9c
BLAKE2b-256 fad0c426bad4856c1def79d2232a125ae8df9a2b91049393ac23e15a9d9e70fe

See more details on using hashes here.

Provenance

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