Git Product home page Git Product logo

chrome_remote_shell's Introduction

#chrome_remote_shell

###Client for the Google Chrome browser's remote debugging shell.

New update replaces old api code with new - no longer compatibile with 3+ year old chrome, now compatible with Chrome Remote Debugging Protocol

See https://developer.chrome.com/devtools/docs/debugger-protocol for details on Chrome's remote debugging protocol.

The protocol is composed of json messages described on the site above.

This library makes it easier to communicate with the Google Chrome remote debugging api from Python. To enable the debugging api port, start Chrome with this option::

google-chrome --remote-shell-port=9222

Note that Chromecast devices also open a remote debugging port and speak this same api, on devices in development mode, and which are currently running a dev app.

Then you can connect from Python through code like this:

Example

>>> import chrome_remote_shell, json
>>> shell = chrome_remote_shell.Shell(host='localhost', port=9222)
>>> shell.connect(0)
>>> url = 'http://www.clift.org/fred' # shameless
>>> navcom = json.dumps({"id":0, "method":"Page.navigate", "params":{"url":url}})
>>> shell.soc.send(navcom)
>>> response = json.loads(shell.recv())

As a convenience, the shell connection object offers a method that, by injecting JavaScript into the first tab, commands Chrome to open a URL in a new tab::

# equivalent to the api call above
>>> shell.open_url('http://www.aldaily.com/')

#TODO Installation

#CHANGELOG 2014 Sept 15. Updated to work with modern Chrome Remote Debugging protocol

2014 Sept 15. Package maintaince transitioned to Fred Clift

2014 Sept 15. Package migrated to GitHub.

2009 Feb 26. Added a conditional import of simplejson so that the module runs under Python 2.5.

chrome_remote_shell's People

Contributors

brandon-rhodes avatar minektur avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.