Devtools Protocol implementation for chrome.
Maintained. Last release 2 months ago, commits in 7 of the last 26 weeks.
pip install choreographerChoreographer
choreographer allows remote control of browsers from Python. It was created to support image generation from browser-based charting tools, but can be used for other purposes as well.
choreographer is available PyPI and github.
Wait—I Thought This Was Kaleido?
Kaleido is a cross-platform library for generating static images of plots. The original implementation included a custom build of Chrome, which has proven very difficult to maintain. In contrast, this package uses the Chrome binary on the user's machine in the same way as testing tools like Puppeteer; the next step is to re-implement Kaleido as a layer on top of it.
Status
choreographer is a work in progress: only Chrome-ish browsers are supported at the moment, though we hope to add others. (Pull requests are greatly appreciated.)
Note that we strongly recommend using async/await with this package, but it is not absolutely required. The synchronous functions in this package are intended as building blocks for other asynchronous strategies that Python may favor over async/await in the future.
Testing
Process Control Tests
- Verbose:
pytest -W error -vvv tests/test_process.py - Quiet:
pytest -W error -v tests/test_process.py
Browser Interaction Tests
- Verbose:
pytest --debug -W error -vvv --ignore=tests/test_process.py - Quiet :
pytest -W error -v --ignore=tests/test_process.py
You can also add "--no-headless" if you want to see the browser pop up.
Writing Tests
- Separate async and sync test files. Add
_sync.pyto synchronous tests. - For process tests, copy the fixtures in
test_process.pyfile. - For API tests, use
test_placeholder.pyas the minimum template.
Help Wanted
We need your help to test this package on different platforms and for different use cases. To get started:
- Clone this repository.
- Create and activate a Python virtual environment.
- Install this repository using
pip install .or the equivalent. - Run
dtdoctorand paste the output into an issue in this repository.