JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 71
  • Score
    100M100P100Q98289F
  • License MIT

Chrome Debugging Protocol interface

Package Exports

  • @u4/chrome-remote-interface
  • @u4/chrome-remote-interface/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@u4/chrome-remote-interface) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

chrome-CDP

[Chrome DevTools Protocol] is a generic protocol to debug / control web browser.

import { Devtools } from "@u4/chrome-remote-interface";
/**
 * Sample API usage
 * 
 * The following snippet loads https://github.com and dumps every request made for 3 sec:
 */
async function test() {
  const devtools = new Devtools();
  const tab = await devtools.connectFirst("page");
  try {
    await tab.Network.enable();
    await tab.Page.enable();

    tab.Network.on("requestWillBeSent", (params) => {
      console.log("requestedUrl:", params.request.url);
    });

    const loadEventFired = tab.Page.loadEventFired();
    await tab.Page.navigate({ url: "https://github.com" });
    await loadEventFired;
    console.log("loadEventFired");
    await new Promise(r => setTimeout(r, 3000));
  } catch (e) {
    console.error(e);
  } finally {
    tab.close();
  }
}

void test()

references