You are here:
Record and Run UI Journeys with Test Script Recorder
Use Test Script Recorder to capture Salesforce UI journeys as Playwright scripts and run them as single or bulk sessions.
Before you begin, install these tools and confirm Salesforce org access:
- Visual Studio Code with the UI Script Recorder extension
- Node.js v22 or later, Playwright and the Playwright test framework, Playwright browsers, and Salesforce CLI (see the prerequisites list for required versions)
- A Salesforce CLI org authenticated with
sf org login web --alias alias(required for MFA, SSO, and Device Activation orgs; requires UI Script Recorder v1.6.1 or later): complete MFA or Device Activation once at login, and the extension generates a one-time login URL per session with no credentials stored. Or use a custom login URL and Salesforce test credentials. - For bulk runs: a user CSV file with
usernameandpasswordcolumns, and one or more data CSV files with columns matching your variable names
Test Script Recorder captures your interactions in a Chromium browser as a Playwright test script. After recording, you parameterize values that change between sessions and validate the script with a single run before you use it as a Scale Test workload.
- In the Visual Studio Code Activity Bar, click UI Script Recorder to open the extension sidebar.
-
In the upper-right corner of the sidebar, click
Start UI Recording, then choose a login method.
- Salesforce CLI org: Select from orgs you've already
authenticated with
sf org login web. No password or MFA prompt is required during recording. Optionally enter a landing path such as/lightning/o/Account/list. - Manual URL: Enter your org's login URL, or leave it blank
to default to
https://login.salesforce.com.
- Salesforce CLI org: Select from orgs you've already
authenticated with
-
Wait for the Chromium browser to open and confirm the recording overlay
appears.
If you chose a manual URL, log in with your test credentials and complete any verification step.
-
Complete the business journey you want to capture.
Wait for each page, panel, or dialog to finish loading before acting. Use unique test data that you can identify and clean up after playback.
-
Click Stop in the recording overlay.
The Chromium window closes and the recording appears in the extension sidebar. The extension generates a JSON file and a
spec.jsPlaywright test script. -
Expand the recording in the sidebar and open the
spec.jsfile. Confirm the actions in the test block match your recorded journey. -
Parameterize values that change between runs.
-
In
spec.js, find an input value you want to vary between sessions. - Above that line, select Parameterize, then select Config Variable.
-
Enter a short, descriptive variable name without spaces, such as
accountName.
-
In
-
Validate the script with a single run before attempting a bulk run.
- In the sidebar, click the Play icon next to the recording, then select Single Run.
- Enter the test username, password, and a value for each custom variable, then start the playback.
- Open Playback Results and confirm the status shows Completed.
A single run opens a visible browser by default. If the run fails, review Playback Results before attempting a bulk run. -
(Optional) Run a bulk playback after the single run succeeds.
- Click the Play icon, then select Bulk Run.
- Select the user CSV file, then select each variable parameter and its corresponding data CSV file.
- Enter the number of sessions to run, then start the playback.
- Monitor progress in Playback Results.
Bulk runs are headless by default. Sessions run in the background without a browser window for each session. When you use Salesforce CLI authentication, each parallel browser process receives its own one-time login URL derived from the same CLI identity, so no additional credentials are required.
Playback results appear in the Playback Results panel. To review an earlier run, select View History next to the recording in the sidebar. To export an HTML report, open Playback Results, select the completed run, and click the HTML export action. Review the report for usernames, screenshots, and other sensitive details before sharing.
Troubleshooting CLI authentication
- Recording doesn't launch with a CLI org: Confirm you're running UI Script Recorder v1.6.1 or later. In VS Code, go to Extensions, find UI Script Recorder, and check the version number.
- CLI session expired: Re-run
sf org login web --alias aliasand complete any MFA or Device Activation prompt. Then start a new recording session. - Org doesn't appear in the CLI org list: Run
sf org listin a terminal to confirm the org is authenticated, then refresh the extension sidebar.
