DevTools Proxy

Build Status PyPI GitHub release

DevTools Proxy is a tool for creating simultaneous connections via DevTools Protocol (which is not possible by default and it is possible since Chrome 63 even without DevTools Proxy).

How it works

+---+      +---+
| C |      |   |
| L |      | D |    +-----------+
| I |      | E |    |           |
| E |<---->| V |    |  BROWSER  |
| N |      | T |    |           |
| T |      | O |    |           |
+---+      | O |    |   +---+   |
           | L |    |   | T |   |
           | S |<-----> | A |   |
+---+      |   |    |   | B |   |
| C |      | P |    |   +---+   |
| L |      | R |    |           |
| I |<---->| O |    |           |
| E |      | X |    |           |
| N |      | Y |    +-----------+
| T |      |   |
+---+      +---+

Installation

Usage

With Selenium and ChromeDriver

There are examples for Python and Ruby. Demos for CPU Throttling, Network requests and Remote debugging.

Standalone (for any language)

Python

devtools-proxy pypi package supports at least Python 3.6. If you use lower Python version use Standalone package.

pip install -U devtools-proxy
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities

from devtools.proxy import CHROME_WRAPPER_PATH

devtools_proxy_binary = 'devtools-proxy' # Or path to `devtools-proxy` from downloaded binaries

capabilities = DesiredCapabilities.CHROME.copy()
capabilities['chromeOptions'] = {
    'binary': CHROME_WRAPPER_PATH, # Or path to `chrome-wrapper.sh` from downloaded binaries
    'args': [
        f'--devtools-proxy-binary={devtools_proxy_binary}',
        # Optional arguments:
        # '--chrome-binary=/path/to/chrome/binary', # Path to real Chrome/Chromium binary
        # '--devtools-proxy-chrome-debugging-port=some-free-port', # Port which proxy will listen. Default is 12222
        # '--devtools-proxy-args=--additional --devtools-proxy --arguments, # Additional arguments for devtools-proxy from `devtools-proxy --help`
    ],
}

With multiple Devtools instances