All Projects → andrewvy → chrome-remote-interface

andrewvy / chrome-remote-interface

Licence: other
Elixir Client for the Chrome Debugger Protocol

Programming Languages

elixir
2628 projects

Projects that are alternatives of or similar to chrome-remote-interface

node-headless-chrome
⚠️ 🚧 Install precompiled versions of the Chromium/Chrome headless shell using npm or yarn
Stars: ✭ 20 (-64.29%)
Mutual labels:  chrome-debugging-protocol, headless-chrome
Serverless Chrome
🌐 Run headless Chrome/Chromium on AWS Lambda
Stars: ✭ 2,625 (+4587.5%)
Mutual labels:  chrome-debugging-protocol, headless-chrome
headless-chrome-alpine
A Docker container running headless Chrome
Stars: ✭ 26 (-53.57%)
Mutual labels:  headless-chrome
dockerfile
A collection of dockerfile I use
Stars: ✭ 90 (+60.71%)
Mutual labels:  headless-chrome
phantom-lord
Handy API for Headless Chromium
Stars: ✭ 24 (-57.14%)
Mutual labels:  headless-chrome
throughout
🎪 End-to-end testing made simple (using Jest and Puppeteer)
Stars: ✭ 16 (-71.43%)
Mutual labels:  headless-chrome
chrome-render
general server render base on headless chrome
Stars: ✭ 92 (+64.29%)
Mutual labels:  headless-chrome
after-work.js
[DEPRECATED] CLI for automated tests in web projects.
Stars: ✭ 56 (+0%)
Mutual labels:  headless-chrome
purescript-toppokki
A binding to puppeteer to drive headless Chrome.
Stars: ✭ 48 (-14.29%)
Mutual labels:  headless-chrome
puppeteer-email
Email automation driven by headless chrome.
Stars: ✭ 135 (+141.07%)
Mutual labels:  headless-chrome
laravel-browsershot
Browsershot wrapper for Laravel 5
Stars: ✭ 108 (+92.86%)
Mutual labels:  headless-chrome
puppeteer-instagram
Instagram automation driven by headless chrome.
Stars: ✭ 87 (+55.36%)
Mutual labels:  headless-chrome
kathisto
📦 Server-side rendering for Javascript based web-apps
Stars: ✭ 17 (-69.64%)
Mutual labels:  headless-chrome
vscode-android-webview-debug
Debug your JavaScript code running in WebViews on any Android device from VS Code.
Stars: ✭ 18 (-67.86%)
Mutual labels:  chrome-debugging-protocol
kroger-cli
Clip coupons and earn points at Kroger-owned grocery chains
Stars: ✭ 95 (+69.64%)
Mutual labels:  headless-chrome
puppeteer-autoscroll-down
Handle infinite scroll on websites by puppeteer
Stars: ✭ 40 (-28.57%)
Mutual labels:  headless-chrome
nest-puppeteer
Puppeteer (Headless Chrome) provider for Nest.js
Stars: ✭ 68 (+21.43%)
Mutual labels:  headless-chrome
generateDeviceScreenshots
A simple command line tool to generate device screenshots of different webpages.
Stars: ✭ 69 (+23.21%)
Mutual labels:  headless-chrome
puppeteer-github
GitHub automation driven by headless chrome.
Stars: ✭ 15 (-73.21%)
Mutual labels:  headless-chrome
headless-chrome
Implementation of the new headless chrome with chromedriver and selenium.
Stars: ✭ 34 (-39.29%)
Mutual labels:  headless-chrome

Chrome Remote Interface

CircleCI

This library provides an Elixir Client to the Chrome Debugging Protocol with a small layer of abstraction for handling and subscribing to domain events.

Note: This is a super minimal client wrapper around the Chrome Debugging Protocol.

Installation

Add :chrome_remote_interface to your mix.exs file!

def deps do
  [
    {:chrome_remote_interface, "~> 0.4.1"}
  ]
end

Chrome DevTools Protocol Selection

Chrome Remote Interface generated its API at compile time from the protocol definition released by the Chrome DevTools Team. For more info see: https://chromedevtools.github.io/devtools-protocol/

This can be overridden by setting CRI_PROTOCOL_VERSION environment variable to:

  • 1-2
  • 1-3 * default
  • tot

Example:

CRI_PROTOCOL_VERSION=1-2 mix compile
CRI_PROTOCOL_VERSION=1-3 mix compile
CRI_PROTOCOL_VERSION=tot mix compile

Usage

Note: In these examples, it assumes you're already running chrome headless with remote debugging enabled.

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

Basic API

# ChromeRemoteInterface works off by creating a Session to the remote debugging port.
# By default, connects to 'localhost:9222
iex(1)> server = ChromeRemoteInterface.Session.new()
%ChromeRemoteInterface.Server{host: "localhost", port: 9222}

iex(2)> {:ok, pages} = ChromeRemoteInterface.Session.list_pages(server)
{:ok,
 [%{"description" => "",
    "devtoolsFrontendUrl" => "/devtools/inspector.html?ws=localhost:9222/devtools/page/d4357ff1-47e8-4e53-8289-fc54089da33e",
    "id" => "d4357ff1-47e8-4e53-8289-fc54089da33e", "title" => "Google",
    "type" => "page", "url" => "https://www.google.com/?gws_rd=ssl",
    "webSocketDebuggerUrl" => "ws://localhost:9222/devtools/page/d4357ff1-47e8-4e53-8289-fc54089da33e"}]}

# Now that we have a list of pages, we can connect to any page by using their 'webSocketDebuggerUrl'
iex(3)> first_page = pages |> List.first()
iex(4)> {:ok, page_pid} = ChromeRemoteInterface.PageSession.start_link(first_page)

# Any methods from https://chromedevtools.github.io/devtools-protocol/1-2/ should be available
# to execute on that Page.

# 'Page.navigate'
iex(5)> ChromeRemoteInterface.RPC.Page.navigate(page_pid, %{url: "https://google.com"})
%{"id" => 1, "result" => %{"frameId" => "95446.1"}}

# 'Page.printToPDF'
iex(6)> ChromeRemoteInterface.RPC.Page.printToPDF(page_pid, %{})
{:ok, %{"id" => 2, "result" => %{"data" => "JVBERi0xLj..."}}}
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].