Gathering detailed insights and metrics for wdio-devtools-service
Gathering detailed insights and metrics for wdio-devtools-service
Gathering detailed insights and metrics for wdio-devtools-service
Gathering detailed insights and metrics for wdio-devtools-service
@wdio/devtools-service
A WebdriverIO service that allows you to run Chrome DevTools commands in your tests
wdio-chromedriver-service
WebdriverIO service to start & stop ChromeDriver
@wdio/local-runner
A WebdriverIO runner to run tests locally
@wdio/utils
A WDIO helper utility to provide several utility functions used across the project.
npm install wdio-devtools-service
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
26 Stars
22 Commits
11 Forks
4 Watching
1 Branches
4 Contributors
Updated on 28 Jan 2023
Minified
Minified + Gzipped
JavaScript (100%)
Cumulative downloads
Total Downloads
Last day
138.6%
105
Compared to previous day
Last week
19.7%
395
Compared to previous week
Last month
-24%
1,499
Compared to previous month
Last year
6.8%
10,980
Compared to previous year
3
18
With Chrome v63 and up the browser started to support multi clients allowing arbitrary clients to access the Chrome DevTools Protocol. This provides interesting opportunities to automate Chrome beyond the WebDriver protocol. With this service you can enhance the wdio browser object to leverage that access and call Chrome DevTools commands within your tests to e.g. intercept requests, throttle network capabilities or take CSS/JS coverage.
Note: this service currently only supports Chrome v63 and up!
The easiest way is to keep wdio-devtools-service
as a devDependency in your package.json
.
1{ 2 "devDependencies": { 3 "wdio-devtools-service": "~0.1.1" 4 } 5}
You can simple do it by:
1npm install wdio-devtools-service --save-dev
Instructions on how to install WebdriverIO
can be found here.
In order to use the service you just need to add the service to your service list in your wdio.conf.js
like:
1// wdio.conf.js 2export.config = { 3 // ... 4 services: ['devtools'], 5 // ... 6};
For now the service allows two different ways to access the Chrome DevTools Protocol:
cdp
CommandThe cdp
command is a custom command added to the browser scope that allows you to call directly commands to the protocol.
1browser.cdp(<domain>, <command>, <arguments>)
For example if you want to get the JavaScript coverage of your page you can do the following:
1it('should take JS coverage', () => { 2 /** 3 * enable necessary domains 4 */ 5 browser.cdp('Profiler', 'enable') 6 browser.cdp('Debugger', 'enable') 7 8 /** 9 * start test coverage profiler 10 */ 11 browser.cdp('Profiler', 'startPreciseCoverage', { 12 callCount: true, 13 detailed: true 14 }) 15 16 browser.url('http://google.com') 17 18 /** 19 * capture test coverage 20 */ 21 const { result } = browser.cdp('Profiler', 'takePreciseCoverage') 22 const coverage = result.filter((res) => res.url !== '') 23 console.log(coverage) 24})
In order to capture events in the browser you can register an event listener to a Chrome DevTools event like:
1it('should listen on network events', () => { 2 browser.cdp('Network', 'enable') 3 browser.on('Network.responseReceived', (params) => { 4 console.log(`Loaded ${params.response.url}`) 5 }) 6 browser.url('https://www.google.com') 7})
All commands can be found in the package.json. The most important are:
Watch changes:
1$ npm run watch
Build package:
1$ npm build
For more information on WebdriverIO see the homepage.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 3/20 approved changesets -- score normalized to 1
Reason
project is archived
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
74 existing vulnerabilities detected
Details
Score
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More