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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10macOS 11.0+ ARM64

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

Uploaded CPython 3.9Windows x86-64

snakeoil_web-0.1.32-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.32-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.32-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for snakeoil_web-0.1.32-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 e9e38d78d146fc66aa732e9074f41b96d2c3e3d07f1d943c21348df3039c8277
MD5 bdfd077bc72114b3f52ad801e888f5bf
BLAKE2b-256 a9749c8ebde795da610a2bda4ccd95a71265f08be828bfe5a8b23f5c161b3112

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.32-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 09b13490f671782abffe4e1eb0559d25a140ab4eb49c64161859fbb87c71672a
MD5 054af6b704f169e60b5853af7cdb7853
BLAKE2b-256 752fd0679386de77e5696abb49e8388b86c30486b68c2762e2b2175dc0a3f541

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.32-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 80b4bb98a05734eb369367f08f93b3068509676341c87a611e2ec35777970b34
MD5 821a16f2ff82c826437918d710d68cd8
BLAKE2b-256 d4b9ad76d19465eb4795b0291159af53ac0c9191397dd4ab297995b7372076f4

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.32-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 1afc17bac5f7d4ae526e9fe900c6675728d53863fffacc8795dcd1543df963ee
MD5 073d77e8d8f2e7829ec25737737d7af6
BLAKE2b-256 95a847435f39664247fffa3a3709429181b9282e0803bb4f8a0caf1cb0e49d54

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.32-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b885428dc9b85ceb94efea05dc18b190479891325e8e7596239c38f009407e05
MD5 8943ee707e1a4a5bb2b6cab631f3b4b9
BLAKE2b-256 ed9f8196489ddf164d098c3330c42e6dcf222de5b6b1e6e82aba3e89a14c5e34

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.32-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 87179a15c423e3aa695ed9a57aee4805c4046b36af205c694961e3e744536d32
MD5 94db3c2b06d68238e5edc69d3a5f2bfd
BLAKE2b-256 233754cddac99e8953081b764069135a46e90ec172474d3e5b3537be283c51d2

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.32-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 fb16ad0351af56303b6ea620187d9fcf087b9b747085ddab3bb91b6eb898f641
MD5 2c9d6e05f6549186bc8bc7c7b0169191
BLAKE2b-256 bfa66de30807ddb322e42688735a9b943f99cc2ecabf63519a00133250a1e21e

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.32-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9bb358f86f8e41158a3d8087c9718302c6e038d9a908b47b7083d25805885334
MD5 20ae3765b84effd96355a9ec62919cb8
BLAKE2b-256 b23dd100a4892850493b93412cfcbbf75050f4c23290da095b5447322be4f5fd

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.32-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 57e9e8716bc28751afc9b5b3cf07d2883571ef3a03aa3ef4906cbb3d0b2d5a69
MD5 be528ca92895ac92868f6b66817b1b55
BLAKE2b-256 01975f7707c9731a0c3af381a44a9cc41a3ea17ac2c7f61490688471e54ee387

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.32-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 8c087bf6361b5bc5f7c71d882175b6a44578e8cb4030c4f1e303bd7f0445eeac
MD5 5fb5430e208073324d4dd750202f7412
BLAKE2b-256 8c182af89aaa02ae0c44d89c1437bfe8a7f8afe804637ad8ea0ccfaffd19b05a

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.32-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0d5f29cd22e6da1884b971dff6c1d1043652fb43383be277006d888b249e6b55
MD5 5014df1d6638f0d10b1f0f8715d2d163
BLAKE2b-256 74a547b103d2838529d08311e54f61a2280282754089cfc60e7c4954147709cd

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.32-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1277f190c360ad6e326fd0c1e4a63bd6c40713bfd11fc4654249029224574020
MD5 304f9c28328eb926e69c6cd8809240ad
BLAKE2b-256 b36459e673abb3d1a606be950fc1054f8dbbf8b8fd108d55871712e4dc7df4e2

See more details on using hashes here.

Provenance

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