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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10macOS 11.0+ ARM64

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

Uploaded CPython 3.9Windows x86-64

snakeoil_web-0.1.44-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.44-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.44-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for snakeoil_web-0.1.44-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 b9230b0889b826e33d588e018f1fb74f365dfd8c2fc195321266f17de5a40e51
MD5 687f1839d1007407fa4c78b07441a2b9
BLAKE2b-256 85cdc266e0d45e1d702c454505b5b6e3d3971cfa160a8087694ed04ba8d1d3ed

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.44-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 fa7291074df7b92f5db5b6fce25aae4d432a923885eaf9e89c5dc682fd906b93
MD5 59e54c28a120bc272649b1740120c045
BLAKE2b-256 60aec59db7255dd62767e9be2f407034c47237dfdcf9f3b2ffebd21736720010

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.44-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 83396e4b2fc5e2142ca0fde2af00d73d38b437bbaea92fa2abd8da0377021c07
MD5 406bdeb4ce701c496ecbcf2f4c1fea1a
BLAKE2b-256 89c3e00b7103c85c34bbdb34b550dd538b20231f0fadb4c7073fe7c914ab5175

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.44-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 f7859a319e1bd5cddb477c60c6ecc449b62c6fe84eaeca182eabbba6c69107a1
MD5 9e3c9c335dda35b88668f26d09f27baf
BLAKE2b-256 e8a334d38403691d5ad3368a5059a195d1d90d1066f61d6437de480a83a9063c

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.44-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 04de67ca3e9ce2f141b070189f7eb54a36308b178390e641873102b7ebc72ccd
MD5 dfe173bbea1250751806e38456c0c558
BLAKE2b-256 72c28dd7cc5b997e658cb2222d447a89567a3d7aebedbf6c97c4ff937ee19cbb

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.44-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 401c29a09869241e941d8ae20f44519b798eec2482aabe4cebefaeb932428a6f
MD5 e66f8c4ce4a27544ebe0a1c92b403351
BLAKE2b-256 1176bdce30c725298554b96b2711ce559eb34d3adc471fa973ffe41ee67c5fb3

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.44-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 48eeba6e64212d373ec38c02bbfc5c69f9045fb061bf12e1838c536c20c4e6cd
MD5 0a5d95ccbe09c62b39d043be38999947
BLAKE2b-256 c79ca15495e4239ab518be534279e3c800b4fb07f3737ef1572cad97ff93f460

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.44-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2aac3b2c104d775439e289743291833b4a07b3dc936023197c90ceb06a503430
MD5 0f5f44ab99af9c5388f0901844a961a3
BLAKE2b-256 72e7a217a19e69cc54a0d13fb60eba6804326b2d0a4ddf8bea4b6b9def41cb78

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.44-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ee137e3b87cd0490b19041a4f758ccd51a8caf669a988af9549da91361f0139c
MD5 8a35243716ec72537ae9b7f42dda500c
BLAKE2b-256 bbcd6f0f01e542d467b342d9873e7c1e8bb22ceae00aa0a9c42a02e175979e10

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.44-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 a296ab1a79981665f804950e0d1ff61de76cc648c31bd8f4f15e82a336a66da5
MD5 a9c47a77553613a621b5c1f6fce19934
BLAKE2b-256 fa141a23db6b0c89c4cb89f4d661814caaa487e805a80cbc723f09e0e0c04cbd

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.44-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5e7dfd843790979ac74afbb5834ae1604b94d13c324edfc4e04c568179b6bc54
MD5 8ea408febf6a320c2296e6e38f7468de
BLAKE2b-256 81b9d35b42ecf6271c6e2fc7c70ce1340dfa44e6095c6e8d9d4bd68cd7501d45

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.44-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 32689b94628fdd990730b102502070190574d73fbda5b76d1496bd93db215490
MD5 727679a06b5f3054b397cfa610015f82
BLAKE2b-256 a671dedefc27c25b6ffe8bbeaa8892863fdd7aae0cc0e41899d0a95304fb08f7

See more details on using hashes here.

Provenance

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