Skip to main content

Trio CDP

PyPI Python Versions MIT License Build Status Read the Docs

This Python library performs remote control of any web browser that implements the Chrome DevTools Protocol. It is built using the type wrappers in python-chrome-devtools-protocol and implements I/O using Trio. This library handles the WebSocket negotiation and session management, allowing you to transparently multiplex commands, responses, and events over a single connection.

The example below demonstrates the salient features of the library by navigating to a web page and extracting the document title.

from trio_cdp import open_cdp, page, dom

async with open_cdp(cdp_url) as conn:
    # Find the first available target (usually a browser tab).
    targets = await target.get_targets()
    target_id = targets[0].id

    # Create a new session with the chosen target.
    async with conn.open_session(target_id) as session:

        # Navigate to a website.
        async with session.page_enable()
        async with session.wait_for(page.LoadEventFired):
            await session.execute(page.navigate(target_url))

        # Extract the page title.
        root_node = await session.execute(dom.get_document())
        title_node_id = await session.execute(dom.query_selector(root_node.node_id,
            'title'))
        html = await session.execute(dom.get_outer_html(title_node_id))
        print(html)

This example code is explained in the documentation and more example code can be found in the examples/ directory of this repository.

Metadata

Release files for trio-chrome-devtools-protocol 0.6.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 trio-chrome-devtools-protocol 0.6.0
File Size Uploaded Provenance Actions
trio-chrome-devtools-protocol-0.6.0.tar.gz 57.1 kB Without provenance Details for trio-chrome-devtools-protocol-0.6.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for trio-chrome-devtools-protocol 0.6.0
File Interpreter ABI Platform Actions
trio_chrome_devtools_protocol-0.6.0-py3-none-any.whl Python 3 none any Details for trio_chrome_devtools_protocol-0.6.0-py3-none-any.whl

Total release size: 136.7 kB

Release files / trio-chrome-devtools-protocol-0.6.0.tar.gz

Download URL trio-chrome-devtools-protocol-0.6.0.tar.gz
Size 57.1 kB
Tags Source
SHA-256 checksum
How to use checksums
fb46d23292b54e63e4e585f5da2e6986372ad8551aff9cd096a2e2765b05f39d
BLAKE2b-256 checksum
How to use checksums
5541fda0aba190d07cc6f9fd1faf3ed0cb52f2bcae073bbeece56cd024b3e745
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.0.5 CPython/3.7.5 Linux/5.3.0-40-generic

Release files / trio_chrome_devtools_protocol-0.6.0-py3-none-any.whl

Download URL trio_chrome_devtools_protocol-0.6.0-py3-none-any.whl
Size 79.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
03082a22060946bc099c1065ae476bc72ef96545d5041e3d341c02b43f886e4f
BLAKE2b-256 checksum
How to use checksums
bef0de591fa5c05a7e1d112653712deb4d5ba99cd58a8b9cc550c50f358b5909
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.0.5 CPython/3.7.5 Linux/5.3.0-40-generic

Security for trio-chrome-devtools-protocol 0.6.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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