All Projects → fate0 → Pychrome

fate0 / Pychrome

Licence: other
A Python Package for the Google Chrome Dev Protocol [threading base]

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Pychrome

Chrome Devtools Protocol
Chrome Devtools Protocol client for PHP
Stars: ✭ 112 (-76.12%)
Mutual labels:  chrome, headless, headless-chrome, chrome-devtools
Html Pdf Chrome
HTML to PDF converter via Chrome/Chromium
Stars: ✭ 629 (+34.12%)
Mutual labels:  chrome, headless, headless-chrome
Wrp
Web Rendering Proxy: Use vintage, historical, legacy browsers on modern web
Stars: ✭ 503 (+7.25%)
Mutual labels:  chrome, headless-chrome, chrome-devtools
Url To Pdf Api
Web page PDF/PNG rendering done right. Self-hosted service for rendering receipts, invoices, or any content.
Stars: ✭ 6,544 (+1295.31%)
Mutual labels:  chrome, headless, headless-chrome
Chromedp
A faster, simpler way to drive browsers supporting the Chrome DevTools Protocol.
Stars: ✭ 7,057 (+1404.69%)
Mutual labels:  chrome, headless, chrome-devtools
Crawlergo
A powerful dynamic crawler for web vulnerability scanners
Stars: ✭ 1,088 (+131.98%)
Mutual labels:  headless, headless-chrome, chrome-devtools
Cuprite
Headless Chrome/Chromium driver for Capybara
Stars: ✭ 743 (+58.42%)
Mutual labels:  chrome, headless, headless-chrome
Chromeless
🖥 Chrome automation made simple. Runs locally or headless on AWS Lambda.
Stars: ✭ 13,254 (+2726.01%)
Mutual labels:  chrome, headless, headless-chrome
Gowitness
🔍 gowitness - a golang, web screenshot utility using Chrome Headless
Stars: ✭ 996 (+112.37%)
Mutual labels:  chrome, headless, headless-chrome
Ferrum
Headless Chrome Ruby API
Stars: ✭ 1,009 (+115.14%)
Mutual labels:  chrome, headless, headless-chrome
Mocha Chrome
☕️ Run Mocha tests using headless Google Chrome
Stars: ✭ 66 (-85.93%)
Mutual labels:  chrome, headless, headless-chrome
Navalia
A bullet-proof, fast, and reliable headless browser API
Stars: ✭ 950 (+102.56%)
Mutual labels:  chrome, headless, headless-chrome
Go Chrome
A golang library for interacting with the Chrome DevTools Protocol. https://chromedevtools.github.io/devtools-protocol/
Stars: ✭ 96 (-79.53%)
Mutual labels:  chrome, headless, chrome-devtools
Phpchrometopdf
A slim PHP wrapper around google-chrome to convert url to pdf or to take screenshots , easy to use and clean OOP interface
Stars: ✭ 127 (-72.92%)
Mutual labels:  chrome, headless, headless-chrome
Api
API that uncovers the technologies used on websites and generates thumbnail from screenshot of website
Stars: ✭ 189 (-59.7%)
Mutual labels:  chrome, headless-chrome
Puppeteer Extra
💯 Teach puppeteer new tricks through plugins.
Stars: ✭ 3,397 (+624.31%)
Mutual labels:  chrome, headless-chrome
Cdp4j
cdp4j - Chrome DevTools Protocol for Java
Stars: ✭ 232 (-50.53%)
Mutual labels:  chrome, chrome-devtools
Chroxy
Headless Chrome as a Service
Stars: ✭ 172 (-63.33%)
Mutual labels:  chrome, headless-chrome
Serverless Chrome
🌐 Run headless Chrome/Chromium on AWS Lambda
Stars: ✭ 2,625 (+459.7%)
Mutual labels:  chrome, headless-chrome
Serverless Puppeteer Layers
Serverless Framework + AWS Lambda Layers + Puppeteer = ❤️
Stars: ✭ 247 (-47.33%)
Mutual labels:  chrome, headless

pychrome

Build Status Codecov Updates PyPI PyPI

A Python Package for the Google Chrome Dev Protocol, more document

Table of Contents

Installation

To install pychrome, simply:

$ pip install -U pychrome

or from GitHub:

$ pip install -U git+https://github.com/fate0/pychrome.git

or from source:

$ python setup.py install

Setup Chrome

simply:

$ google-chrome --remote-debugging-port=9222

or headless mode (chrome version >= 59):

$ google-chrome --headless --disable-gpu --remote-debugging-port=9222

or use docker:

$ docker pull fate0/headless-chrome
$ docker run -it --rm --cap-add=SYS_ADMIN -p9222:9222 fate0/headless-chrome

Getting Started

import pychrome

# create a browser instance
browser = pychrome.Browser(url="http://127.0.0.1:9222")

# create a tab
tab = browser.new_tab()

# register callback if you want
def request_will_be_sent(**kwargs):
    print("loading: %s" % kwargs.get('request').get('url'))

tab.Network.requestWillBeSent = request_will_be_sent

# start the tab 
tab.start()

# call method
tab.Network.enable()
# call method with timeout
tab.Page.navigate(url="https://github.com/fate0/pychrome", _timeout=5)

# wait for loading
tab.wait(5)

# stop the tab (stop handle events and stop recv message from chrome)
tab.stop()

# close tab
browser.close_tab(tab)

or (alternate syntax)

import pychrome

browser = pychrome.Browser(url="http://127.0.0.1:9222")
tab = browser.new_tab()

def request_will_be_sent(**kwargs):
    print("loading: %s" % kwargs.get('request').get('url'))


tab.set_listener("Network.requestWillBeSent", request_will_be_sent)

tab.start()
tab.call_method("Network.enable")
tab.call_method("Page.navigate", url="https://github.com/fate0/pychrome", _timeout=5)

tab.wait(5)
tab.stop()

browser.close_tab(tab)

more methods or events could be found in Chrome DevTools Protocol

Debug

set DEBUG env variable:

pychrome_with_debug_env

Tab management

run pychrome -h for more info

example:

pychrome_tab_management

Examples

please see the examples directory for more examples

Ref

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].