Socket
Socket
Sign inDemoInstall

webpagetest-chrome-recorder

Package Overview
Dependencies
Maintainers
0
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

webpagetest-chrome-recorder

This module will help you to convert JSON user flows from Google Chrome DevTools Recorder to WEBPAGETEST Custom Scripts


Version published
Weekly downloads
9
increased by125%
Maintainers
0
Weekly downloads
 
Created
Source

Webpagetest Chrome Recorder

Learn about more WebPageTest API Integrations in our docs

WEBPAGETEST CHROME RECORDER

contributions welcome

This tool will help you to convert JSON user flows from Google Chrome DevTools Recorder to WEBPAGETEST Custom Scripts

Converts recordings to Webpagetest scripts using CLI / Module (Wrapper Funstions).

Check out our Webpagetest Chrome extension to export JSON user flows as Webpagetest custom scripts straight away from Chrome DevTools.

🏗 Installation

npm install -g webpagetest-chrome-recorder

🚀 Usage

To quickly run the interactive CLI, run:

npx webpagetest-chrome-recorder

The CLI will prompt you for the path to the chrome devtool recordings you wish to modify and the location to write the Nightwatch tests.

⚡️ Transform individual recordings

npx webpagetest-chrome-recorder <path to the chrome devtools recording>

⚡️ Transform multiple recordings (Space delimited)

npx webpagetest-chrome-recorder <path.json> <path.json>

👉 By default output will be written to webpagetest folder.

You can specify different output directory, specify that via cli

npx webpagetest-chrome-recorder <path to the chrome devtools recording> --output=<folder-name>

⚙️ CLI Options

OptionDescription
-d, --dryDry run the output of the transformed recordings
-o, --outputSet Output location for the exports

💻 Programmatic API

import { WPTStringifyChromeRecording } from "webpagetest-chrome-recorder";

const recording = {
  title: "recording",
  steps: [
    {
      type: "setViewport",
      width: 812,
      height: 609,
      deviceScaleFactor: 1,
      isMobile: false,
      hasTouch: false,
      isLandscape: false,
    },
    {
      type: "navigate",
      url: "https://timkadlec.com/",
      assertedEvents: [
        {
          type: "navigation",
          url: "https://timkadlec.com/",
          title: "TimKadlec.com - Web Performance Consulting | TimKadlec.com",
        },
      ],
    },
  ],
};

const customScript = await WPTStringifyChromeRecording(recording);

console.log(customScript);


//setViewportSize 812 609
//setEventName Navigate
//navigate https://timkadlec.com/
//# recorderSourceMap=BABBC

Steps to obtain Chrome user flow recordings

Refer to Recorder docs for more information on Chrome Recorder

#Open the Recorder panel

  • Open DevTools.
  • Click on More options --> More tools > Recorder.

Screenshots of Script

#Export the JSON


NOTE

  • Only Chrome v101 and above i.e. Google Chrome Developer and Google Chrome Canary exports these json scripts.
  • Make sure that your recording plays back correctly in Chrome before feeding it into The Recorder Script (To obtain the expected outcome)

After you are done with the recording

  • Click on export icon and select "Export as a JSON file"

Screenshots of Script

Once that is done, feed the JSON into the recorder script to generate the WPT custom script

Currently Supported Recorder Commands

  • navigate (maps to navigate)
  • setViewport (maps to setViewportSize)
  • click (maps to execAndWait)
  • change (maps to execAndWait)
  • keydown (maps to execAndWait)
  • keyup (maps to execAndWait)
  • waitForElement (maps to waitFor)
  • waitForExpression (maps to waitFor)
  • doubleClick (maps to execAndWait)
  • scroll (maps to execAndWait)

Resources


NOTE

  • Only Chrome v101 and above supports export json scripts.

Keywords

FAQs

Package last updated on 24 Jul 2024

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