Overview Open Chrome DevTools What's New in DevTools DevTools tips Simulate mobile devices with Device Mode Performance insights: Get actionable insights on your website's performance Lighthouse: Optimize website speed Animations: Inspect and modify CSS animation effects Changes: Track your HTML, CSS, and JavaScript changes Coverage: Find unused JavaScript and CSS CSS Overview: Identify potential CSS improvements Issues: Find and fix problems Media: View and debug media players information Memory Inspector: Inspect ArrayBuffer, TypedArray, DataView, and Wasm Memory. Network conditions: Override the user agent string Security: Understand security issues Search: Find text across all loaded resources Sensors: Emulate device sensors WebAuthn: Emulate authenticators Customize DevTools Engineering blog
Overview Open Chrome DevTools What's New in DevTools DevTools tips Simulate mobile devices with Device Mode Performance insights: Get actionable insights on your website's performance Lighthouse: Optimize website speed Animations: Inspect and modify CSS animation effects Changes: Track your HTML, CSS, and JavaScript changes Coverage: Find unused JavaScript and CSS CSS Overview: Identify potential CSS improvements Issues: Find and fix problems Media: View and debug media players information Memory Inspector: Inspect ArrayBuffer, TypedArray, DataView, and Wasm Memory. Network conditions: Override the user agent string Security: Understand security issues Search: Find text across all loaded resources Sensors: Emulate device sensors WebAuthn: Emulate authenticators Customize DevTools Engineering blog

Features reference

Published on Updated on

Discover ways to share user flows, edit them and their steps in this comprehensive features reference of the Chrome DevTools Recorder panel.

To learn the basics of working with the Recorder panel, see Record, replay, and measure user flows.

Learn and customize shortcuts

Use shortcuts to navigate the Recorder faster. For a list of default shortcuts, see Recorder panel keyboard shortcuts.

To open a hint that lists all the shortcuts right in the Recorder, click Show shortcuts. Show shortcuts in the top right corner.

The Show shortcuts button.

To customize Recorder shortcuts:

  1. Open Settings. Settings > Shortcuts.
  2. Scroll down to the Recorder section.
  3. Follow the steps in Customize shortcuts.

Edit user flows

DevTools Recorder panel has a drop-down menu in the header which allows you to select a user flow to edit.

On the top of the Recorder panel, there are options for you to:

  1. Add a new recordingAdd.. Click on the + icon to add a new recording.

  2. View all recordingsExpand more.. The drop-down shows the list of saved recordings. Select the [number] recording(s) option to expand and manage the list of saved recordings. View all recordings.

  3. Export a recordingFile download.. To further customize the script or share it for bug reporting purposes, you can export the user flow in one of the following formats:

    For more information on the formats, see Export a user flow.

  4. Import a recordingFile upload.. Only in JSON format.

  5. Delete a recordingDelete.. Delete the selected recording.

You can also edit the recording's name by clicking the edit button Edit. next to it.

Share user flows

You can export and import user flows in the Recorder. This is useful for bug reporting because you can share an exact record of the steps that reproduce a bug. You can also export and replay it with external libraries.

Export a user flow

To export a user flow:

  1. Open the user flow you want to export.
  2. Click File download. Export at the top of the Recorder panel. Export format options.
  3. Select one of the following formats from the drop-down list:
    • JSON file. Download the recording as a JSON file.
    • @puppeteer/replay. Download the recording as a Puppeteer Replay script.
    • Puppeteer. Download the recording as a Puppeteer script.
    • Puppeteer (including Lighthouse analysis). Download the recording as a Puppeteer script with an embedded Lighthouse analysis.
    • One or more options provided by Recorder Extensions.
  4. Save the file.

You can do the following with each default export option:

  • JSON. Edit the human-readable JSON object and import the JSON file back to the Recorder.

  • @puppeteer/replay. Replay the script with the Puppeteer Replay library. When exporting as a @puppeteer/replay script, the steps remain a JSON object. This option is perfect if you want to integrate with your CI/CD pipeline but still have the flexibility to edit the steps as JSON, later convert and import them back into the Recorder.

  • Puppeteer script. Replay the script with Puppeteer. Because the steps are converted into JavaScript, you can have more fine-grained customization, for example, looping the steps. One caveat, you can't import this script back into the Recorder.

  • Puppeteer (including Lighthouse analysis). This export option is the same as the previous one but it includes code that generates a Lighthouse analysis.

    Run the script and check out the output in a flow.report.html file:

    # npm i puppeteer lighthouse
    node your_export.js
    The Lighthouse report opened in Chrome.

Export in a custom format by installing an extension

Note: This feature is available from Chrome version 104.

To integrate the Recorder with your tools, install extensions:

  1. Select File download. Export > Get extensions... at the top of the Recorder panel or go to Extensions.
  2. Choose an extension and click its link.
  3. In Chrome Web Store, click Add extension.
  4. Open DevTools in a new tab and find new custom options in the Recorder.
Export and replay extensions.

Currently, there are two types of extensions: Export and Replay.

Troubleshooting

If you don't see the export option after installing the extension, do the following:

  • The extension only works on web pages. For example, the export option is not available for chrome:// pages like chrome://extensions.
  • Always open a new browser tab after installing the extension.
  • There is an issue in Chrome 104 and 105 that prevents the export option showing if you open the Recorder as the first DevTools panel. As a workaround, open another panel (for example, Console) first before opening the Recorder. The issue is fixed in Chrome 106.
Important

Advanced use case: Build an extension

To further customize the Recorder to your needs, you can build your own extension:

  1. Explore the chrome.devtools.recorder API.
  2. Check out example extensions.
  3. Develop your extension and publish it at Chrome Web Store.
  4. Feel free to add it to the Extensions list.

Import a user flow

To import a user flow:

  1. Click the ImportFile upload. button at the top of the Recorder panel. Import recording.
  2. Select the JSON file with the recorded user flow.
  3. Click the Replay.Replay button to run the imported user flow.

Replay with external libraries

The Puppeteer Replay is an open source library maintained by the Chrome DevTools team. It is built on top of Puppeteer. It is a command line tool, you can replay JSON files with it.

Apart from that, you can transform and replay JSON files with the following 3rd party libraries.

Transform JSON user flows to custom scripts:

Replay JSON user flows:

Important

Advanced use case: Integrate with the Puppeteer Replay library

Similar to the 3rd party libraries above, you can build your own library on top of the Puppeteer Replay too. The Puppeteer Replay library provide ways for you to customize how a recording is run and "stringify" the user flow JSON files, that is, convert them to something else.

Debug user flows

Like any code, sometimes you have to debug the recorded user flows.

To help you debug, the Recorder panel lets you slow down the replays, set breakpoints, step through the execution, and inspect code in various formats in parallel with steps.

Slow down the replay

By default, the Recorder replays the user flow as fast as it can. To understand what happens in the recording, you can slow down the replay speed:

  1. Open the Replay.Replay drop-down menu.
  2. Choose one of the replay speed options:
    • Normal (Default)
    • Slow
    • Very slow
    • Extremely slow
Slow replay.
Important

You can use these slow replay options only in the Recorder. To add timeouts to the recording itself, see Adjust timeouts for steps.

Inspect code

To inspect the code of a user flow in various formats:

  1. Open a recording in the Recorder panel.

  2. Click Show code in the top right corner of the steps list. The Show code button.

  3. The Recorder shows a side-by-side view of the steps and their code. The side-by-side view of the steps and their code.

  4. As you hover over a step, the Recorder highlights its respective code in any format, including those provided by extensions.

  5. Expand the format drop-down list to select a format that you use to export user flows.

    The format drop-down list.

    It can be one of the three default formats (JSON, @puppeteer/replay, Puppeteer script or a format provided by an extension.

  6. Proceed to debug your recording by editing step parameters and values. The code view isn't editable but it updates accordingly as you make changes to steps on the left.

Set breakpoints and execute step by step

To set a breakpoint and execute step by step:

  1. Hover over the Step. circle next to any step in a recording. The circle turns into a Breakpoint. breakpoint icon.
  2. Click the Breakpoint. breakpoint icon and replay the recording. The executions pauses at the breakpoint. Execution pause.
  3. To step through the execution, click the Execute one step. Execute one step button on the action bar at the top of the Recorder panel.
  4. To stop the replay, click Pause. Cancel replay.

Edit steps

You can edit any step in the recording by clicking the Expand. button next to it.

You can also add missing steps and remove accidentally recorded ones as described below.

Add steps

Sometimes, you may need to add steps manually. For example, the Recorder doesn't automatically capture hover events because this pollutes the recording and not all such events are useful. However, UI elements such as drop-down menus can appear only on hover. You can manually add hover steps to user flows that depend on such elements.

To manually add a step:

  1. Open this demo page and start a new recording. Start a recording to capture a hover event.
  2. Hover over the element in the viewport. An action menu pops up. Hovering over the element.
  3. Pick an action from the menu and end the recording. The Recorder captures only the click event. Clicking an action and ending the recording.
  4. Try to replay the recording by clicking Replay. Replay. The replay fails after a timeout because the Recorder can't access the element in the menu. Replay fail.
  5. Click the Three-dot button. three-dot button next to the Click step and select Add step before. Adding a step before Click.
  6. Expand the new step. By default, it has the waitForElement type. Click the value next to type and select hover. Selecting hover.
  7. Next, set an appropriate selector for the new step. Click Select. Select, then click an area on the Hover over me! element that's outside the pop-up menu. The selector is set to #clickable. Setting the selector.
  8. Try replaying the recording again. With the added hover step, the Recorder successfully replays the flow. Replay success.

Copy steps

Instead of exporting the entire user flow, you can copy a single step to the clipboard:

  1. Right-click the step you want to copy or click the Three-dot menu. three-dot icon next to it.
  2. In the drop-down menu, select one of the Copy as ... options.
Selecting a copy option from the drop-down menu.

You can copy steps in various formats: JSON, Puppeteer, @puppeteer/replay, and those provided by extensions.

Remove steps

To remove an accidentally recorded step, right-click the step or click the Three-dot menu. three-dot icon next to it and select Remove step.

Remove a step.

Additionally, the Recorder automatically adds two separate steps to the start of every recording:

A recording with the set viewport and navigation steps.
  • Set viewport. Lets you control the viewport's dimensions, scaling, and other properties.
  • Navigate. Sets the URL and automatically refreshes the page for every replay.

To perform in-page automation without reloading the page, remove the navigation step as described above.

Configure steps

To configure a step:

  1. Specify its type: click, doubleClick, hover, (input) change, keyUp, keyDown, scroll, close, navigate (to a page), waitForElement, waitForExpression, or setViewport.

    Other properties depend on the type value.

  2. Specify the required properties below the type.

    Configuring a step.
  3. Click the corresponding buttons to add optional type-specific properties and specify them.

For a list of available properties, see Step properties.

To remove an optional property, click the Remove. Remove button next to it.

To add or remove an element to or from an array property, click the + or - buttons next to the element.

Step properties

Each step can have the following optional properties:

  • target—a URL for the Chrome DevTools Protocol (CDP) target, the default main keyword refers to the current page.
  • assertedEvents that currently can only be a single navigation event

Other common properties available for most of the step types are:

  • frame—an array of zero-based indexes that identify an iframe that can be nested. For example, you can identify the first (0) iframe inside a second (1) iframe of the main target as [1, 0].
  • timeout—a number of milliseconds to wait before executing a step. For more information, see Adjust timeouts for steps.
  • selectors—an array of selectors. For more information, see Understand selectors.

Type-specific properties are:

TypePropertyRequiredDescription
click
doubleClick
offsetX
offsetY
Check.Relative to the top-left of the element content box, in pixels
click
doubleClick
buttonPointer button: primary | auxiliary | second | back | forward
changevalueCheck.Final value
keyDown
keyUp
keyCheck.Key name
scrollx
y
Absolute scroll x and y positions in pixels, default 0
navigateurlCheck.Target URL
waitForElementoperator>= | == (default) | <=
waitForElementcountNumber of elements identified by a selector
waitForExpressionexpressionCheck.JavaScript expression that resolves to true
setViewportwidth
height
Check.Width and height of the viewport in pixels
setViewportdeviceScaleFactorCheck.Similar to Device Pixel Ratio (DPR), default 1
setViewportisMobile
hasTouch
isLandscape
Check.Boolean flags that specify whether to:
  • Take the meta tag into account
  • Support touch events
  • Display in landscape mode
  • There are two properties that make the replay pause:

    • The waitForElement property makes the step wait for the presence (or absence) of a number of elements identified by a selector. For example, the following step waits for less than three elements to be on the page that match the selector .my-class.

        "type": "waitForElement",
      "selectors": [".my-class"],
      "operator": "<=",
      "count": 2,
    • The waitForExpression property makes the step wait for a JavaScript expression to resolve to true. For example, the following step pauses for two seconds and then resolves to true allowing the replay to continue.

         "type": "waitForExpression",
      "expression": "new Promise(resolve => setTimeout(() => resolve(true), 2000))",

    Adjust timeouts for steps

    In case your page has slow network requests or lengthy animations, the replay can fail on steps that exceed the default timeout of 5000 milliseconds.

    To avoid this problem, you can adjust the default timeout for each step at once or set separate timeouts for specific steps. Timeouts on specific steps overwrite the default.

    To adjust the default timeout for each step at once:

    1. Click on Replay settings to make the Timeout box editable.

      Replay settings.
    2. In the Timeout box, set the timeout value in milliseconds.

    3. Click Replay.Replay to see the adjusted default timeout in action.

    To overwrite the default timeout on a specific step:

    1. Expand the step and click Add timeout.

      Add timeout.
    2. Click on the timeout: <value> and set the value in milliseconds.

      Set the timeout value.
    3. Click Replay.Replay to see the step with the timeout in action.

    To remove a timeout overwrite on a step, click the DeleteDelete. button next to it.

    Understand selectors

    When you start a new recording, you can configure the following:

    Configuring a new recording.
    • In the Selector attribute textbox, enter a custom test attribute. The Recorder will use this attribute to detect selectors instead of a list of common test attributes.

    • In the Selector types to record set of checkboxes, choose the types of selectors to detect automatically:

      • Checkbox. CSS. Syntactic selectors.
      • Checkbox. ARIA. Semantic selectors.
      • Checkbox. Text. Selectors with the shortest unique text if available.
      • Checkbox. XPath. Selectors that use XML Path Language.
      • Checkbox. Pierce. Selectors similar to the CSS ones but that can pierce shadow DOM.

    Common test selectors

    For simple webpages, id attributes and CSS class attributes are sufficient for the Recorder to detect the selectors. However, that might not always be the case because:

    • Your webpages may use dynamic classes or IDs that change.
    • Your selectors may break because of code or framework changes.

    For example, the CSS class values might be auto-generated for applications developed with modern JavaScript frameworks (for example, React, Angular, Vue) and CSS frameworks.

    Auto-generated CSS classes with randomized names.

    In these cases, you can use data-* attributes to create more resilient tests. There are already some common data-* selectors that developers use for automation. The Recorder supports them as well.

    If you have the following common test selectors defined on your website, the Recorder automatically detects and uses them first:

    • data-testid
    • data-test
    • data-qa
    • data-cy
    • data-test-id
    • data-qa-id
    • data-testing

    For example, inspect the "Cappuccino" element on this demo page and see the test attributes:

    Defined test selectors.

    Record a click on "Cappuccino", expand the corresponding step in the recording, and check the detected selectors:

    Detected common test selector.

    Customize the recording's selector

    You can customize the selector of a recording if the common test selectors don't work for you.

    For example, this demo page uses the data-automate attribute as the selector. Start a new recording and enter the data-automate as the selector attribute.

    Customize the recording's selector.

    Fill in an email address and observe the selector value ([data-automate=email-address]).

    The result of custom selector selection.

    Selector priority

    The Recorder looks for selectors in the following order depending on if you specified a custom CSS selector attribute:

    • If specified:
      1. CSS selector with your custom CSS attribute.
      2. XPath selectors.
      3. ARIA selector if found.
      4. A selector with the shortest unique text if found.
    • If not specified:
      1. ARIA selector if found.
      2. CSS selectors with the following priority:
        1. The most common attributes used for testing:
          • data-testid
          • data-test
          • data-qa
          • data-cy
          • data-test-id
          • data-qa-id
          • data-testing
        2. ID attributes, for example, <div id="some_ID">.
        3. Regular CSS selectors.
      3. XPath selectors.
      4. Pierce selectors.
      5. A selector with the shortest unique text if found.

    There can be multiple regular CSS, XPath, and Pierce selectors. The Recorder captures:

    • Regular CSS and XPath selectors at every root level, that is, nested shadow hosts, if any.
    • Pierce selectors that are unique among all elements within all shadow roots.

    Updated on Improve article

    We serve cookies on this site to analyze traffic, remember your preferences, and optimize your experience.