Features reference

Sofia Emelianova
Sofia Emelianova

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 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 N 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 Export at the top of the Recorder panel.

    A list of format options in the Export menu.

  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 (for Firefox). Download the recording as a Puppeteer for Firefox script.
    • Puppeteer (including Lighthouse analysis). Download the recording as a Puppeteer script with an embedded Lighthouse analysis.
    • One or more options provided by the Recorder's Export 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 (for Firefox). As part of WebDriver BiDi support, you can run this Puppeteer script on both Chrome and Firefox.
  • 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

See Recorder extensions.

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:

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.

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, both during the recording and after.

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

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.

Add assertions

During recording, you can assert, for example, HTML attributes and JavaScript properties. To add an assertion:

  1. Start a recording, for example, on this demo page.
  2. Click Add assertion.

    The Add assertion button.

    The Recorder creates a configurable waitForElement step.

  3. Specify selectors for this step.

  4. Configure the step but don't change its waitForElement type. For example, you can specify:

    • HTML attribute. Click Add attributes and type the attribute's name and value that elements on this page use. For example, data-test: <value>.
    • JavaScript property. Click Add properties and type the property's name and value in JSON format. For example, {".innerText":"<text>"}.
    • Other step properties. For example, visible: true.
  5. Proceed to record the rest of the user flow and then stop the recording.

  6. Click Replay. Replay. If an assertion fails, the Recorder displays an error after a timeout.

Watch the following video to see this workflow in action.

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.

    Configure 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 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:

Type Property Required Description
click
doubleClick
offsetX
offsetY
Check. Relative to the top-left of the element content box, in pixels
click
doubleClick
button Pointer button: primary | auxiliary | second | back | forward
change value Check. Final value
keyDown
keyUp
key Check. Key name
scroll x
y
Absolute scroll x and y positions in pixels, default 0
navigate url Check. Target URL
waitForElement operator >= | == (default) | <=
waitForElement count Number of elements identified by a selector
waitForElement attributes HTML attribute and its value
waitForElement properties JavaScript property and its value in JSON
waitForElement visible Boolean. True if the element is in the DOM and visible (doesn't have display: none or visibility: hidden)
waitForElement
waitForExpression
asserted events Currently, only type: navigation but you can specify the title and URL
waitForElement
waitForExpression
timeout Maximum time to wait in milliseconds
waitForExpression expression Check. JavaScript expression that resolves to true
setViewport width
height
Check. Width and height of the viewport in pixels
setViewport deviceScaleFactor Check. Similar to Device Pixel Ratio (DPR), default 1
setViewport isMobile
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 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.