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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10macOS 11.0+ ARM64

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

Uploaded CPython 3.9Windows x86-64

snakeoil_web-0.1.37-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.37-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.37-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for snakeoil_web-0.1.37-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 7a622f9a2eb0ade2686bd41e5ea6f314aa10fa455b7d7ea432dfce129e92f5c6
MD5 7b5dfefaafb0919f5df639d0256a94b0
BLAKE2b-256 dab1185f2275450f264f81be673dd483aad7af2de6454da453a123bbd793dfe8

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.37-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5cd527066513577ba877fab0b66fb5ed7b95c778de3730e56f394217ae07ce3d
MD5 b9b27c066fad61027d85742b6c8d47ec
BLAKE2b-256 5b6dcb990c68e8a36ccbc03193eb6c31008f9df17302f8683d3ab0d9fd1323d3

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.37-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1036066d6152e03f8d75913b8fd94e8601c12e61a89c2400112421261fb39f87
MD5 a28073e8278ae252f3ba2b0bfe066318
BLAKE2b-256 8f057315c67ef06115c2ccf6efeed391c89558ec0b12016ade20cd17e1dd100d

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.37-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 96b1cc2fff357ef6332144a91e7abb6c860012d388bcecc16e3b3183b9c9c8b8
MD5 1af89dbe969910553b34f5ad11e8f181
BLAKE2b-256 11f4697274e763f2ab9099bf56aca599d6f3d5c5052c47e29c4fcb31ef5a0935

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.37-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 806ce87b2cba2adf60698b7a72f7d4b01256e9c08e197ad48367a8dbb2abe9cb
MD5 ff7f6be74600afcb5ee6d59a438574bc
BLAKE2b-256 b32026827925f94d7f35609cc661dcd5a007153dedb232dbdf3443b72c9c2d81

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.37-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 59124a1cf122c46cdc8d0c96b84d8c58936f342b988a0d560452f72bf22a7fbc
MD5 ad063262fb761a1e54a2f203c0e2a4e7
BLAKE2b-256 bf33cffafdf657d9a5c32205caecd5e28c7d13f224d2dec01131ba28a6074d52

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.37-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 b02c2816c7d07b1de9ce1a71e33278cd9bad294a4f72d0b0bafffabd70a0375c
MD5 6b838b1a85f281777f8d9e55e6e71422
BLAKE2b-256 3347d8f52879b419375e9053542930aa84c6ca489534bb3fba3ab57ec2f75a10

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.37-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 304f2e56f65344b605c5c2557eae23888225d135f44e43344a83a12bcaee554d
MD5 9554deba4995007d575be300a4121c6b
BLAKE2b-256 8c1a9f01e93f30b97a17ed2c0a5d7ed52c4cc8f88d6bffea7ba4f793d593d0a3

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.37-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 98d4f387026890eadd7ae6dbea13cc43c86139733d56fdeb687f998be1f1b012
MD5 88daae4dccdd3121e050f8f94fa91f45
BLAKE2b-256 84f9f69349e8dddb5a5b1d4c77b11a668a09c8613542e4238a1ec9271aa70b13

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.37-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 9ddb14b9eb0987e2472c9aba7da87975564d414ba1f84007ae1b6375da53afb7
MD5 c9bf6abce5846e81aa9eecac4167399a
BLAKE2b-256 1424eafe9cbe6c8389153211cca2f32082a685edc107f7d286c59f5ec9d96b50

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.37-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a323e5813aa93e43fa1789fed91edd813ccf47ef999f712aa6f41a9379f4cd47
MD5 011cf61982313754c2bf00ad3ed35b56
BLAKE2b-256 67fafb3442ef883994bd24b312a0899c8c614ef2f490126f56d72ccc8c2f3a24

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.37-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 cc3af752cb1c81f9f6a6db7fc55d70eb7b6837cb854c72be0f84ecd27f1563a2
MD5 a20d4b5b2ebec144bbf1d2b3d881ff2f
BLAKE2b-256 717c4d59272c7661b3236cf23280d731e63b30eb4e22796bdb9f1df84285a612

See more details on using hashes here.

Provenance

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