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

Uploaded CPython 3.12Windows x86-64

snakeoil_web-0.1.38-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.9 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10macOS 11.0+ ARM64

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

Uploaded CPython 3.9Windows x86-64

snakeoil_web-0.1.38-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.38-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.38-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for snakeoil_web-0.1.38-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 04499c0e1944d3d92a2091ba95e64ce47e885cc4576e0be1d2483c2e7afe61f4
MD5 4bc1e853c4c6bd4835cba0973ed94152
BLAKE2b-256 04464381536760dd7563aebddc1f37cdddf45fe43585adbab283fd56acd07b72

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.38-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7fd11263d7e0784e5a4c88a2b34f0fa1b913348ebca228c4d5fe38739c9a5fc7
MD5 e4b151311b2ec4e1c94a6ac902cb0bd4
BLAKE2b-256 89f99b3baaa4dee5a64ef8fe15be19babde3995ce525781b5e413f168f0fdccf

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.38-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ea2f1cc2fc038fa64f4217b74f66c72387667b93270acabdb811a17c1f020438
MD5 508cb5548b2faacf79f1370c44d42835
BLAKE2b-256 ff08938436a1536772ab678262f53edae8fef90634dc7920066370a24978db35

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.38-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 fb8c3ce32fd7aa6a243ddb5bed2a33b8f7c8e0310b7ed35bb63f26e3bab7262b
MD5 ce7960840db6e2d22a3e1d6c096425c4
BLAKE2b-256 7496c4e2423ecceb7a632a4e3ea05f02413deec6fa18b28cd5e4a502509f1e0f

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.38-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 abc855b4fa7ed0692dff473a98433c3dcd28cbf7d2b3c1e1918991d3d7f2c51a
MD5 3ce8d20fd5e4d28af1acfe860b914954
BLAKE2b-256 63217d989c56b03e48fc740060159ac2a0ca50680e16fcd8d996213b4bf9101b

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.38-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a554ae0b72522c2563ecd516cfd3caf3138f5521201e1ef5669d57a20d8264af
MD5 5c1e60c276388f310f45788213d4a463
BLAKE2b-256 80744473678c64935a524bc20e91c7b7b03e04c4a396f0d927f0042bc36cbb14

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.38-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 25bc09e478b89eb75abb5fd0e8b7ac5449649057c83b1f5dd5f503a4197800fe
MD5 e9d3c0099ff6e5be35022838ec3a1eb9
BLAKE2b-256 41478b3bd402a84fe1690ef2b8ae8f2be2a0ab3ea3dfa1f259191cc05c454ebb

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.38-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 fb0f3da0553f62b3b3a7444fb0b3cd65733e7f81b427a598b7a928901bca67d1
MD5 812acd5574ddbdb1f89bc262e3c0bb02
BLAKE2b-256 1ef5abacb1c21850bd59f75a014239ac8c76ef2df7636572acfc81c7e2870a69

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.38-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 629fac883d992add4ae06aebff1ad85033342853dad0fefbac868774c28e2ee9
MD5 9767746d3c1db55c9aab365a162bfcb7
BLAKE2b-256 117e5fce85e759c996a741d1dfeafe02847dac10b0005c7f42df8d84b3432361

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.38-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 6ffa1757d05ed4106acba80319c8cd58350af468706ae40024dcd3f4822b9a0b
MD5 3c102fd3f79608c41657615126465c0d
BLAKE2b-256 d17da6b2c4b60ccc71d118cea0df88e360e56cc316a41954805711af25e3d131

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.38-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 065fb1a7c4fadc15c84fd7b2692502d33c7d8fb89079af6991adbbc2a1c3198b
MD5 97900d81046c3521d2915fa518d5b3cd
BLAKE2b-256 a01c89c59b63b3742e7c1f6089aeaafc90e9ef6e3f0f8fd115229110280ac3b5

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.38-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 15490c14975d3c5f465e00b4a172f122237cfa978906fa7cf7d5dd0d63decfca
MD5 0bca1e92fbd033267cc23e11f4558c7d
BLAKE2b-256 5a1cf1329647d129ec855cf1c5d22f368231a864e77475b81aba1e6d97ed4646

See more details on using hashes here.

Provenance

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