Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
CProto is a Debugging Protocol client that supports Chrome, Chromium and Blink based browsers.
CProto provides you an advanced interface to interact with Chrome (or another supported browser) instance from your Python code. It's greatly useful for automated testing, debugging, profiling or even complicated page crawling.
Getting Started
_API Docs
_Roadmap
_Chrome Headless
_Examples
_This project is under development. More updates are coming soon.
Installing CProto ^^^^^^^^^^^^^^^^^
Python 2.7 or 3.3+ is required to install CProto.
Install the latest version using pip:
.. code:: sh
$ pip install cproto
Running Chrome in Debug mode ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Option 1: Run Chrome in Docker
_, also in Headless mode.
Option 2: Run Chrome on host machine:
.. code:: sh
chrome --remote-debugging-port=9222 "about:blank"
alias chrome="/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome"
alias chrome-canary="/Applications/Google\ Chrome\ Canary.app/Contents/MacOS/Google\ Chrome\ Canary"
alias chromium="/Applications/Chromium.app/Contents/MacOS/Chromium"
Chrome Debugging Protocol documentation.
_
CProto complies to official Chrome Debugging Protocol, which implicates CProto's interface has the same API as Chrome Debugging Protocol. Consider this example:
.. code:: python
from cproto import CProto
def on_load(response): print(response) cp.close()
cp = CProto(host='127.0.0.1', port=9222)
cp.Page.enable()
cp.Page.loadEventFired = on_load
cp.Page.navigate(url='https://github.com')
In this example Page Domain API
_ was used to navigate to any arbitrary
URL. There are a whole bunch of other methods and events available for
each Domain, you could browse all of them on the CDP documentation
website.
Under consideration:
You could use Docker
_ to run CProto with Chrome Headless mode on
any major OS via command line interface.
.. code:: sh
$ git clone git@github.com:asyne/cproto.git
$ docker build -t chrome-headless cproto
$ docker run --rm -it --cap-add=SYS_ADMIN -p 9222:9222 chrome-headless
Check out examples directory
_.
Take a Screenshot
_More examples are coming soon.
.. _Getting Started: #getting-started .. _API Docs: #api-docs .. _Roadmap: #roadmap .. _Chrome Headless: #chrome-headless .. _Examples: #examples .. _Run Chrome in Docker: #chrome-headless .. _Chrome Debugging Protocol documentation.: https://chromedevtools.github.io/devtools-protocol/ .. _Page Domain API: https://chromedevtools.github.io/devtools-protocol/tot/Page/ .. _Docker: https://www.docker.com/ .. _examples directory: https://github.com/asyne/cproto/tree/master/examples .. _Take a Screenshot: https://github.com/asyne/cproto/blob/master/examples/screenshot.py
FAQs
Chrome Debugging Protocol client
We found that cproto demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.