Skip to content

clear-code/browser-protocol-vagrant

Repository files navigation

Vagrant for Chromium DevTools Protocol

This repository is used to setup headless Chromium virtual machine.

Internally, two systemd services are running in virtual machine.

  • browser-protocol.service
  • browser-protocol-tunnel.service

browser-protocol.service launches Chromium with headless mode which is enabled remote debugging port feature.

browser-protocol-tunnel.service provides forwarded 9223 port (public endpoint) to access internal remote debugging port 9222 from host machine.

Install

Install Ansible:

Install Git:

For Debian or Ubuntu:

% sudo apt install -y -V git

For CentOS:

% sudo yum install -y git

Clone this repository:

% git clone https://github.com/clear-code/browser-protocol-vagrant

Start virtual machine. It takes long time...:

% cd browser-protocol-vagrant
% vagrant up

Usage

DevTools Protocol endpoint is provided by http://192.168.92.22:9223/json. Note that you can't directly access port 9222 (DevTools Protocol default port) from host machine because of limitation about this protocol.

Here is the sample request to show how it works.

$ curl http://192.168.92.22:9223/json
[ {
   "description": "",
   "devtoolsFrontendUrl": "/devtools/inspector.html?ws=192.168.92.22:9223/devtools/page/1a67968b-2752-4e96-9ddf-44e50fea68c4",
   "id": "1a67968b-2752-4e96-9ddf-44e50fea68c4",
   "title": "DevTools Protocol sample",
   "type": "page",
   "url": "file:///tmp/in.html",
   "webSocketDebuggerUrl": "ws://192.168.92.22:9223/devtools/page/1a67968b-2752-4e96-9ddf-44e50fea68c4"
} ]

About

Setup VM instance accessing via Chrome/Chromium DevTools protocol

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •