Git Product home page Git Product logo

chromeremote's Introduction

Chrome Remote

A tool for Chrome remote dev debugging. Support:

  1. Method callback.
  2. Event callback.
  3. Threaded. Async return.

Install

  1. use pip:

pip install chromeremote

  1. Download this repo and run:

pip install . or python set.py install

  1. from git:

pip install git+https://github.com/sadnoodles/chromeremote

This commad require git.exe.

Example

First use chrome.exe --remote-debugging-port=9222 start Chrome ( need close all existing chrome windows first). Then run the example with: python example.py. This a simple example for how to use callback.

#!/usr/bin/env python
# -*- coding: utf-8 -*-
from chromeremote import ChromeTabThread


def print_ret(kwargs):
    # This func will be called when received a registed chrome event.
    assert kwargs.has_key('current_tab')
    print kwargs
    return


class ExampleTab(ChromeTabThread):

    def test_recv(self, result):
        # Handle received result here.
        print "Received result:", result

    def run(self):
        self.register_event("Network.responseReceived",
                            print_ret)  # Register a event before thread started.
        self.open_tab()
        self.Network.enable(maxTotalBufferSize=10000000,
                            maxResourceBufferSize=5000000)
        self.Page.enable(callback=self.test_recv)  # You can add callback for every request.
        self.Page.navigate(url='http://www.baidu.com/')
        self.Page.getResourceTree()
        super(ExampleTab, self).run()


def main():
    import time
    tab = ExampleTab('127.0.0.1', 9222)
    tab.start()
    time.sleep(10)
    tab.kill()
    time.sleep(2)


if __name__ == '__main__':
    main()

A XSS detection Example is added. See xssbot.py Thanks for howmp.

Generator mode example See generator_example.py

chromeremote's People

Contributors

sadnoodles avatar

Watchers

Joel Johnson avatar James Cloos avatar  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.