Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

devtools-protocol

Package Overview
Dependencies
Maintainers
3
Versions
1274
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

devtools-protocol

The Chrome DevTools Protocol JSON

  • 0.0.1232444
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
9M
increased by10.45%
Maintainers
3
Weekly downloads
 
Created

What is devtools-protocol?

The devtools-protocol npm package provides a set of TypeScript definitions for the Chrome DevTools Protocol, which allows you to interact with the Chrome browser for tasks such as debugging, profiling, and inspecting web pages programmatically.

What are devtools-protocol's main functionalities?

Page Navigation

This feature allows you to navigate to a specific URL and wait for the page to load. The code sample demonstrates how to use the Page domain to navigate to 'https://example.com' and wait for the load event.

const CDP = require('chrome-remote-interface');

(async function() {
  const client = await CDP();
  const { Page } = client;
  await Page.enable();
  await Page.navigate({ url: 'https://example.com' });
  await Page.loadEventFired();
  console.log('Page loaded');
  await client.close();
})();

JavaScript Execution

This feature allows you to execute JavaScript code within the context of the web page. The code sample demonstrates how to evaluate a JavaScript expression to get the page title.

const CDP = require('chrome-remote-interface');

(async function() {
  const client = await CDP();
  const { Runtime } = client;
  await Runtime.enable();
  const result = await Runtime.evaluate({ expression: 'document.title' });
  console.log('Page title:', result.result.value);
  await client.close();
})();

Network Monitoring

This feature allows you to monitor network requests made by the web page. The code sample demonstrates how to listen for network requests and log the URLs of the requests.

const CDP = require('chrome-remote-interface');

(async function() {
  const client = await CDP();
  const { Network } = client;
  await Network.enable();
  Network.requestWillBeSent((params) => {
    console.log('Request:', params.request.url);
  });
  await client.Page.navigate({ url: 'https://example.com' });
  await client.Page.loadEventFired();
  await client.close();
})();

Other packages similar to devtools-protocol

FAQs

Package last updated on 03 Dec 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc