🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

@wdio/devtools-service

Package Overview
Dependencies
Maintainers
3
Versions
451
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@wdio/devtools-service

A WebdriverIO service that allows you to run Chrome DevTools commands in your tests

8.42.0
latest
Source
npm
Version published
Weekly downloads
162K
10.45%
Maintainers
3
Weekly downloads
 
Created

What is @wdio/devtools-service?

@wdio/devtools-service is a WebdriverIO service that provides integration with Chrome DevTools Protocol. It allows you to use Chrome DevTools features in your WebdriverIO tests, such as capturing performance metrics, taking screenshots, and more.

What are @wdio/devtools-service's main functionalities?

Capturing Performance Metrics

This feature allows you to capture performance metrics such as First Meaningful Paint, DOM Content Loaded, and more. The code sample demonstrates how to capture these metrics for a given URL.

const { remote } = require('webdriverio');
const options = { capabilities: { browserName: 'chrome' } };
(async () => {
  const browser = await remote(options);
  await browser.url('https://example.com');
  const metrics = await browser.getMetrics();
  console.log(metrics);
  await browser.deleteSession();
})();

Taking Screenshots

This feature allows you to take screenshots of the current browser window. The code sample demonstrates how to navigate to a URL and take a screenshot.

const { remote } = require('webdriverio');
const options = { capabilities: { browserName: 'chrome' } };
(async () => {
  const browser = await remote(options);
  await browser.url('https://example.com');
  const screenshot = await browser.takeScreenshot();
  console.log(screenshot);
  await browser.deleteSession();
})();

Network Throttling

This feature allows you to simulate different network conditions. The code sample demonstrates how to throttle the network to simulate a slower connection.

const { remote } = require('webdriverio');
const options = { capabilities: { browserName: 'chrome' } };
(async () => {
  const browser = await remote(options);
  await browser.url('https://example.com');
  await browser.throttle({
    offline: false,
    downloadThroughput: 500 * 1024 / 8,
    uploadThroughput: 500 * 1024 / 8,
    latency: 20
  });
  await browser.deleteSession();
})();

Other packages similar to @wdio/devtools-service

Keywords

webdriver

FAQs

Package last updated on 12 Feb 2025

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