All Projects → asyne → cproto

asyne / cproto

Licence: MIT License
Chrome Debugging client for Python

Programming Languages

python
139335 projects - #7 most used programming language
Dockerfile
14818 projects
shell
77523 projects

Projects that are alternatives of or similar to cproto

tinypacks
A data serialization format for constrained environments like 8-bit and 16-bit microcontrollers.
Stars: ✭ 30 (+3.45%)
Mutual labels:  protocol
debug.cr
Debug macro for Crystal
Stars: ✭ 86 (+196.55%)
Mutual labels:  debugging
elm-monitor
Monitor your elm program with redux-devtools
Stars: ✭ 20 (-31.03%)
Mutual labels:  debugging
protocol
Package protocol implements Language Server Protocol specification in Go
Stars: ✭ 41 (+41.38%)
Mutual labels:  protocol
CSS-Lecture-And-Exercises
🎨 Get to know CSS! It's fun!
Stars: ✭ 11 (-62.07%)
Mutual labels:  debugging
question-driven-learning
Stay hungry stay foolish
Stars: ✭ 17 (-41.38%)
Mutual labels:  debugging
pytest-faulthandler
py.test plugin that activates the fault handler module during testing
Stars: ✭ 27 (-6.9%)
Mutual labels:  debugging
dwex
DWARF Explorer - a GUI utility for navigating the DWARF debug information
Stars: ✭ 58 (+100%)
Mutual labels:  debugging
port-numbers
Get information on network port numbers and services, based on IANA's public listing
Stars: ✭ 22 (-24.14%)
Mutual labels:  protocol
be.camp
Open source website for the beCamp unconference in Charlottesville, VA
Stars: ✭ 16 (-44.83%)
Mutual labels:  headless
gree-remote
Simple remote control utility for Gree Smart air conditioners
Stars: ✭ 150 (+417.24%)
Mutual labels:  protocol
pydbg
Python implementation of the Rust `dbg` macro
Stars: ✭ 85 (+193.1%)
Mutual labels:  debugging
rfc
Modular p2p messaging stack, with a focus on secure messaging.
Stars: ✭ 81 (+179.31%)
Mutual labels:  protocol
r2lldb
radare2-lldb integration
Stars: ✭ 54 (+86.21%)
Mutual labels:  debugging
m3forth
m3forth is a forth cross-compiler for cortex-m3 ARM microcontrollers
Stars: ✭ 16 (-44.83%)
Mutual labels:  debugging
ynm3k
ynm3k.readthedocs.io
Stars: ✭ 20 (-31.03%)
Mutual labels:  debugging
example-node-and-browser-qunit-ci
Example project with continuous integration for linting and cross-browser testing of isomorphic JavaScript.
Stars: ✭ 18 (-37.93%)
Mutual labels:  headless
pretty trace
Love Your Ruby's Backtrace
Stars: ✭ 13 (-55.17%)
Mutual labels:  debugging
lips
📘 Lisk improvement proposals
Stars: ✭ 61 (+110.34%)
Mutual labels:  protocol
slabdbg
GDB plug-in that helps exploiting the Linux kernel's SLUB allocator
Stars: ✭ 55 (+89.66%)
Mutual labels:  debugging

CProto

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.

This project is under development. More updates are coming soon.

Getting Started

Installing CProto

Python 2.7 or 3.3+ is required to install CProto.

Install the latest version using pip:

$ 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:

# «chrome» should point to your installation of Chrome
chrome --remote-debugging-port=9222 "about:blank"

# If you haven't created alias for Chrome yet, you could set it on MacOS like that:
# For Chrome
alias chrome="/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome"
# For Chrome Canary
alias chrome-canary="/Applications/Google\ Chrome\ Canary.app/Contents/MacOS/Google\ Chrome\ Canary"
# For Chromium
alias chromium="/Applications/Chromium.app/Contents/MacOS/Chromium"

API Docs

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:

from cproto import CProto


# Print event's response and close CProto connection
def on_load(response):
    print(response)
    cp.close()


# Create CProto instance and connect to a browser over CDP
cp = CProto(host='127.0.0.1', port=9222)
# Enable Page domain events
cp.Page.enable()
# Adds Page callback that's fired after is loaded
cp.Page.loadEventFired = on_load
# Navigate browser to Github
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.

Roadmap

  • Domains support
  • Methods support
  • Events support

Under consideration:

  • Asynchronous I/O support using asyncio

Headless Chrome in Docker

You could use Docker to run CProto with Chrome Headless mode on any major OS via command line interface.

# Clone the repository
$ git clone [email protected]:asyne/cproto.git

# Build Docker image for Chrome Headless
$ docker build -t chrome-headless cproto

# Run Docker Chrome Headless mode container with port 9222 being proxied to the host machine
$ docker run --rm -it --cap-add=SYS_ADMIN -p 9222:9222 chrome-headless

# That's all here. Chrome Debugging interface is now up and listening for connections.
# You could check it out by opening this link in your browser – http://localhost:9222.

Examples

Check out examples directory.

More examples are coming soon.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].