solvecdp
solvecdp is fastcdp for solveit: the same async Python client for the Chrome DevTools Protocol, but driving the user’s own browser from a solveit kernel. Every CDP domain is a Python attribute with auto-generated signatures and docstrings, plus event subscription, navigation and form helpers, accessibility tree access, and console/network/dialog debugging buffers. Since the kernel runs on a remote server, frames are relayed through rustygate’s /api/wsx websocket channel (exposed to browsers at /rusty/api/wsx) to the solveit-chrome extension, which executes them with chrome.debugger.
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."
Connect (one connection per browser), then open a tab:
cdp = await JsCDP.connect()
page = await cdp.new_page()
Go to a page:
await page.goto('https://httpbingo.org/forms/post')
Eval js:
await page.eval('document.title')
'6. httpbin.org/forms/post'
Or you can wait_for any js expression to be truthy, and have it returned:
await page.wait_for('document.title')
'6. httpbin.org/forms/post'
Take a screenshot of the page:
img = await page.screenshot()
Clean up when done:
await page.close()
See JsCDP docs for full details.
Filling forms
page = await cdp.new_page(url='https://httpbingo.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()
await cdp.close()
Running AppleScript on your Mac
With the solvebridge menu bar app connected to your Solveit instance, osa (or async aosa) runs AppleScript on your Mac over /api/wsx?chan=mac and returns standard output:
osa('tell application "Microsoft Word" to activate')
To allow LLMs like solveit with safepyrun to access solvecdp, use:
cdp_yolo()
Then use a prompt such as:
Try using python to connect a
cdp_JsCDP object and open apage_tab withnew_page, 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.9
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.9.tar.gz | 10.5 kB | Without provenance | Details for solvecdp-0.0.9.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| solvecdp-0.0.9-py3-none-any.whl | Python 3 | none | any | Details for solvecdp-0.0.9-py3-none-any.whl |
Total release size: 21.4 kB
Release files / solvecdp-0.0.9.tar.gz
| Download URL | solvecdp-0.0.9.tar.gz |
|---|---|
| Size | 10.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
25a6f2ce3145af19e07399cb1894aa375cb733322dbf3a7fc8a302c1f9152c69
|
|
BLAKE2b-256 checksum How to use checksums |
455530769fad11f109d9b0e722466b90e40c3dc9e9be3ebd0d4f539ffb055451
|
| 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.9-py3-none-any.whl
| Download URL | solvecdp-0.0.9-py3-none-any.whl |
|---|---|
| Size | 10.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d902fa11da9d0a7d9a7ec68d5bc8536036c03bafc38402c5333898503ec0105a
|
|
BLAKE2b-256 checksum How to use checksums |
2339d2b9b7461e38a9a848adbee1dec19623778e74f8f54d15268c1c81167110
|
| 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.9
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.