solvecdp
fastcdp provides an async Python client for the Chrome DevTools Protocol (CDP) over solveit’s js bridge. It exposes every CDP domain as a Python attribute with auto-generated signatures and docstrings — e.g. await cdp.page.navigate(url=...).
It includes event subscription via cdp.on()/cdp.wait_event(), navigation helpers (goto, wait_for_selector, wait_for), screenshot capture, and accessibility tree access. A cdp_search utility lets you search CDP commands by name or description. For use inside safepyrun sandboxes, cdp_yolo() registers all CDP classes.
Installation
You must install the solveit-chrome extension before using solvecdp.
Solveit already has solvecdp installed, but if you want to install the latest you can get it from pypi:
$ pip install solvecdp
How to use
from solvecdp import *
The JsCDP class
Every CDP domain is available as an attribute with auto-generated signatures. You can search for commands with cdp_search:
cdp_search('screenshot')
"Emulation.setVisibleSize: Resizes the frame/viewport of the page. Note that this does not affect the frame's container\n(e.g. browser window). Can \nHeadlessExperimental.beginFrame: Sends a BeginFrame to the target and returns when the frame was completed. Optionally captures a\nscreenshot from the res\n evt Overlay.screenshotRequested: Fired when user asks to capture screenshot of some area on the page.\nPage.captureScreenshot: Capture page screenshot."
Create a new page:
jc = await JsCDP.new()
Go to a page:
await jc.goto('https://httpbin.org/forms/post')
Eval js:
await jc.eval('document.title')
'6. httpbin.org/forms/post'
Or you can wait_for any js expression to be truthy, and have it returned:
await jc.wait_for('document.title')
'6. httpbin.org/forms/post'
Take a screenshot of the page:
img = await jc.screenshot()
Clean up when done:
await jc.close()
See JsCDP docs for full details.
Filling forms
page = await JsCDP.new(url='https://httpbin.org/forms/post')
For finding elements to interact with, use ax_tree:
root = await page.ax_tree()
print(str(root)[:300])
- **RootWebArea** "6. httpbin.org/forms/post" `focusable=True` `url=https://httpbin.org/forms/post` [#14]
- **LabelText** "" [#20]
- **StaticText** "Customer name: " [#62]
- **InlineTextBox** "Customer name: "
- **textbox** "Customer name: " `focusable=True` `editable=plaintext` `set
find and find_id are used to identify elements in the tree:
nmid = root.find_id('textbox', 'Customer name')
nmid
2
You can use regular CDP methods, or one of the provided shortcuts:
await page.fill_text(nmid, 'Jeremy Howard')
await page.click(root.find_id('radio', 'Large'))
await page.js_node_run('this.value = "18:30"', root.find_id('InputTime', 'delivery time'));
You can use click to click a button, or click_and_wait to wait for the next page to load:
await page.click_and_wait(root.find_id('button', 'Submit order'))
await page.close()
To allow LLMs like solveit with safepyrun to access solvecdp, use:
cdp_yolo()
Then use a prompt such as:
Try using python to create a
page_JsCDP object, then goto<url>, fill it out, read it to check it’s filled correctly, then submit it, and see what you get back. Don’t use find_id - you can get all the ids at once with ax_tree (don’t truncate the result of it). Don’t add extra waits etc - solvecdp handles it automatically. IDs can change so be sure to use the ax_tree IDs you read.
Metadata
Release files for solvecdp 0.0.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| solvecdp-0.0.7.tar.gz | 8.9 kB | Without provenance | Details for solvecdp-0.0.7.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| solvecdp-0.0.7-py3-none-any.whl | Python 3 | none | any | Details for solvecdp-0.0.7-py3-none-any.whl |
Total release size: 18.4 kB
Release files / solvecdp-0.0.7.tar.gz
| Download URL | solvecdp-0.0.7.tar.gz |
|---|---|
| Size | 8.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7c19cc69a9971f45a0fe10cde09b605aa8e7b8b3d7444e4f3c2b3dbd3e23884d
|
|
BLAKE2b-256 checksum How to use checksums |
4228c01edbb695805a3faec5e3d23cccbb38d7100267bedc336d3403bc2cf395
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.15
|
Release files / solvecdp-0.0.7-py3-none-any.whl
| Download URL | solvecdp-0.0.7-py3-none-any.whl |
|---|---|
| Size | 9.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
78c69df48c8e5d278dc4b705c103a2f012cb8931d51a8415000da7bbfa40ce86
|
|
BLAKE2b-256 checksum How to use checksums |
99c7b6699be11803137ee7e4ea4592a952a4cae86b02df13930e28e840dc90c7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.15
|
Security for solvecdp 0.0.7
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.