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 = "."

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

Uploaded CPython 3.12Windows x86-64

snakeoil_web-0.1.23-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.23-cp312-cp312-macosx_11_0_arm64.whl (1.5 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

snakeoil_web-0.1.23-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.23-cp310-cp310-macosx_11_0_arm64.whl (1.5 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

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

Uploaded CPython 3.9Windows x86-64

snakeoil_web-0.1.23-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.23-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.23-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for snakeoil_web-0.1.23-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 fa545533686748d1cc0c7086f530af3b6845df0e697d0c6df73c7a3cca510ea8
MD5 5ce7cfd39e0513ad3c462dc829fb3ff4
BLAKE2b-256 81cb707056e7b9fbe6d566077dcead2c0e7df0218aebe9a4001c260370d2633c

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.23-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e8b5e43252865a4641cc2d9045ae07dd7c66af5c2c531eb1963845843723e327
MD5 194c4403b0fc6478a644ba755d0fabba
BLAKE2b-256 e7531c1e060dbbe7db93abd37a9c409d7f658734d8c22d078531316f0b1c032a

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.23-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a89c5d01c2d17a6988b1f025d66da83a7abdd1779185e42d19b66a586a91509c
MD5 b6749e1b0d9fd25f0c9db3d6aaf2a3d6
BLAKE2b-256 236130708cf26c0360a515b04e14f8001062df5a8a3f27a57b192e9867b96781

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.23-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 d9ab22774adb060def8b01ec916fd2a835c351f238133b1f19472344cd195dfa
MD5 72f219e959c56b5d57d9739f73673e6a
BLAKE2b-256 4d9b17edab4b71152ae4db50fe4137f302a2105dd1c83ed05c9dbb7230db0002

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.23-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 92a8b15054778294656f53b298dd856028cbcc5423715428083c8ff701c91b8b
MD5 8f1f6985a2171b8cbf3a0c1a238da60b
BLAKE2b-256 2778484a97976c42e63852b9f2df010dba20014ff8354d550a0eabcf5205e3f4

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.23-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4f6c9afb40127f921c06e383422ff1aad1bb8e21f32119cddb637f60827e2bae
MD5 3219addbedc1d9e71453e7ccd8ee6c85
BLAKE2b-256 ebee765959e6b4edce29a5337a9e7a569c43c5f888d1226672073df733c3e0c3

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.23-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 0cf65cc776df9d8b76d86eb20011145261cb84354932275fcbbf4995f8405a7c
MD5 a046445a4abce29e907af49789a85e0b
BLAKE2b-256 a39965dbc1b607649cb0cfe253e4370ef7834785900058aa14d2f237c3d8a790

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.23-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 31a367be65f4fadc36354e63088e6db4d6c0f34ca820d76554ed5786a73b3887
MD5 4ffc284eca294bc837675052e4e160cf
BLAKE2b-256 12bcdd3587530063a4cd8b7064d71eb9178a175fe833d69c3e1590aa6bbe0b88

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.23-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1ec510ee152b89bc1125c1aabe5bfed69f5a9ca0e3d89b433e9b17583eec3627
MD5 a163b829006f04b01ff30f64dd10b6d3
BLAKE2b-256 ec4608e5fa2c35026b7c3ba86d3490784825755b8eb8116c6ef61f67a34a42e5

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.23-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 1127f5407f6ff34e9a49f2159d3666a842f269bfa384f6d8d20fc8ca8d4d78e5
MD5 33c53c64b68cb90146f628e89ad4f15c
BLAKE2b-256 f9ff8fcab1957ceb9355ee5096948beaec18664d544d54a16301b3e91896387f

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.23-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3deca1a89f1838d8e063b6729778485eb3416e1135fb357e9b130721afa98030
MD5 367c5032eae01a0a42c402a65bdfc433
BLAKE2b-256 5a1e41b902ac870a9359365fdb33ff78055ced1ee76d051cacc0bd104c0c5e24

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for snakeoil_web-0.1.23-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 93dfa8a35ddbca80e4256549863d08ad7075a3ca3bb05d71472032eebc0b9149
MD5 f8a9233029cabc1e666e55871877736e
BLAKE2b-256 7b9627a0ef1fa495ed3e8824d533b25f1474f23b31605609da4abf40c35fb99b

See more details on using hashes here.

Provenance

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