Skip to main content

playwright-localstorage

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.

Metadata

Release files for playwright-localstorage 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for playwright-localstorage 1.1.0
File Size Uploaded
playwright_localstorage-1.1.0.tar.gz 4.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for playwright-localstorage 1.1.0
File Interpreter ABI Platform
playwright_localstorage-1.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 10.5 kB

Release files / playwright_localstorage-1.1.0.tar.gz

Download URL playwright_localstorage-1.1.0.tar.gz
Size 4.5 kB
Tags Source
SHA-256 checksum
How to use checksums
4159805712dd6576870ae5cf66b16435a10998544548abd1b8b74a452e69e187
BLAKE2b-256 checksum
How to use checksums
58173ff07b363912014fe2802c5c87f7b3c7b8ff16225480d28e04fdeade09b5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.0.1 CPython/3.12.8

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 3, 2025.

Transparency log

Release files / playwright_localstorage-1.1.0-py3-none-any.whl

Download URL playwright_localstorage-1.1.0-py3-none-any.whl
Size 6.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3951bbee63230d6d9f85c04d927b710ba0bdc2d59b0cb20376e316e1e049475e
BLAKE2b-256 checksum
How to use checksums
58f2187e2539c74b4c347d2bacbb64d87ae74142d32e5517828b84a99b68dfc4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.0.1 CPython/3.12.8

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 3, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 release files

1.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page