Socket
Socket
Sign inDemoInstall

devtools

Package Overview
Dependencies
Maintainers
2
Versions
383
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

devtools

A Chrome DevTools protocol binding that maps WebDriver commands into Chrome DevTools commands using Puppeteer


Version published
Weekly downloads
818K
increased by4.95%
Maintainers
2
Weekly downloads
 
Created
Source

DevTools

A Chrome DevTools protocol binding that maps WebDriver commands into Chrome DevTools commands using Puppeteer

This package provides a low level interface to run browser automation scripts based on the WebDriver protocol. If you are looking for a tool to automate Chrome or Firefox you should look up Puppeteer. This is suppose to be used by the WebdriverIO package in order to run its automation on the Chrome DevTools protocol.

Install

$ npm i webdriverio

Example

The following example demonstrates how WebdriverIO can be used with the devtools package as automation binding using the automationProtocol option:

const { remote } = require('webdriverio')

let browser;

(async () => {
    browser = await remote({
        automationProtocol: 'devtools',
        capabilities: {
            browserName: 'chrome'
        }
    })

    await browser.url('https://webdriver.io')

    /**
     * run Puppeteer code
     */
    await browser.call(async () => {
        const page = (await browser.puppeteer.pages())[0]
        await page.setRequestInterception(true)
        page.on('request', interceptedRequest => {
            if (interceptedRequest.url().endsWith('webdriverio.png')) {
                return interceptedRequest.continue({
                    url: 'https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png'
                })
            }

            interceptedRequest.continue()
        })
    })

    // continue with WebDriver commands
    await browser.refresh()
    await browser.pause(2000)

    /**
     * now on the https://webdriver.io page you see the Puppeteer logo
     * instead of the WebdriverIO one
     */

    await browser.deleteSession()
})().catch(async (e) => {
    console.error(e)
    await browser.deleteSession()
})

Commands

The following commands are already supported:

Selector Strategies

Browser

  • Chrome
  • Firefox (nightly only)
  • Edge
  • Safari

Keywords

FAQs

Package last updated on 20 Jan 2021

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