Extension for the Playwright package that allows access to the Web Storage API.
Project description
playwright-localstorage
Extension for the Playwright package that allows access to the Web Storage API.
Installation
pip install playwright-localstorage
Usage
Synchronous
from playwright.sync_api import Playwright
from playwright.sync_api import sync_playwright
from playwright_localstorage import LocalStorageAccessor
def run(p: Playwright):
chromium = p.chromium
browser = chromium.launch(headless=False)
page = browser.new_page()
page.goto("http://example.com")
accessor = LocalStorageAccessor(page)
accessor.set("token", "secret-token") # Set value
token = accessor.get("token") # Get value
print(token) # >> "secret-token"
exists = accessor.has("token") # Check key for existence
print(exists) # >> True
keys = accessor.keys() # Get all keys
print(keys) # >> ["token"]
items = accessor.items() # Get all items
print(items) # >> {"token": "secret-token"}
accessor.remove("token") # Remove key
exists = accessor.has("token")
print(exists) # >> False
browser.close()
with sync_playwright() as playwright:
run(playwright)
Asynchronous
The package supports asynchronous implementation.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file playwright_localstorage-1.0.1.tar.gz.
File metadata
- Download URL: playwright_localstorage-1.0.1.tar.gz
- Upload date:
- Size: 4.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
614cb25015b48d6039e719f1ec383ff68c7fedba8d05fd507a681bb7d629a959
|
|
| MD5 |
93401fc97db309448576808dc6c6dd77
|
|
| BLAKE2b-256 |
9467028e56b0ebc3350f5301f74d5aa39b9aa30670551ba7ea4d98642931440f
|
Provenance
The following attestation bundles were made for playwright_localstorage-1.0.1.tar.gz:
Publisher:
release.yml on swimmwatch/playwright-localstorage
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
playwright_localstorage-1.0.1.tar.gz -
Subject digest:
614cb25015b48d6039e719f1ec383ff68c7fedba8d05fd507a681bb7d629a959 - Sigstore transparency entry: 158115365
- Sigstore integration time:
-
Permalink:
swimmwatch/playwright-localstorage@b0cf0afb9970e0487dd7ebe98db75816efa52e98 -
Branch / Tag:
refs/tags/v1.0.1 - Owner: https://github.com/swimmwatch
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@b0cf0afb9970e0487dd7ebe98db75816efa52e98 -
Trigger Event:
release
-
Statement type:
File details
Details for the file playwright_localstorage-1.0.1-py3-none-any.whl.
File metadata
- Download URL: playwright_localstorage-1.0.1-py3-none-any.whl
- Upload date:
- Size: 6.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
12f717f7655ad1f7011f16097463fb8fe217793752200789a4fdaeedf9f62011
|
|
| MD5 |
5e5be014b6e04f961de3f85c8096e0c1
|
|
| BLAKE2b-256 |
dff2ce81e24fbb267fc066b3b7f8a4fba3d55f86ad9c0d5177f288f1b4212305
|
Provenance
The following attestation bundles were made for playwright_localstorage-1.0.1-py3-none-any.whl:
Publisher:
release.yml on swimmwatch/playwright-localstorage
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
playwright_localstorage-1.0.1-py3-none-any.whl -
Subject digest:
12f717f7655ad1f7011f16097463fb8fe217793752200789a4fdaeedf9f62011 - Sigstore transparency entry: 158115367
- Sigstore integration time:
-
Permalink:
swimmwatch/playwright-localstorage@b0cf0afb9970e0487dd7ebe98db75816efa52e98 -
Branch / Tag:
refs/tags/v1.0.1 - Owner: https://github.com/swimmwatch
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@b0cf0afb9970e0487dd7ebe98db75816efa52e98 -
Trigger Event:
release
-
Statement type: