The Record & Replay recorder is a tool for creating automated scripts. They help you verify that tested web pages and app behavior is consistent across different browsers, screen resolutions, and operating systems.
Open the recorder
The recorder opens automatically after you start recording. As you record user actions in your web application, they will appear in the test recorder.
At design time
Select Record & Replay > Record a Script from the menu on the left, find your script on the page, click the , and select Edit Script from the subsequent menu:
If you are on the script properties screen, then to open the recorder, click Edit Steps:
Here is a sample view of the recorder screen:
The most of it is occupied by the embedded browser. You use it to interact with the tested web page during recording, and to watch the script run (when you run your script from the recorder).
A script consists of steps which consist of events. Steps usually correspond to individual web pages in a web application, and events correspond to user actions such as link clicks or keyboard input (see below).
CrossBrowserTesting records a new step when the URL in the browser address bar is changed. To insert a new step manually, click Add > Step. This is especially helpful when recording tests for single-page applications (SPA) where the URL does not change.
The maximum number of steps for a script is 45. You can see the number of used and available steps during test recording at the bottom of the recorder screen.
The recorder registers the following event types:
- Mouse movements
- Clicks of the left mouse button (clicks on links and buttons, or anywhere on a page)
- Clicks of the right mouse button
- Scrolling events
- Keyboard input events (including keystrokes of navigation keys and keyboard shortcuts, see below)
- File upload events
- “Think Time” events (they indicate pauses between user actions)
For click events, the recorder saves the text of the link or button you clicked. This text serves as an event label and helps you navigate through events in your test. You can change it later, if needed. See below.
The recorder registers right-click events if they cause some further action like opening a page or popping up a dialog box. Right-clicks that open the context menu of a browser are not recorded.
A list of supported keys and keyboard shortcutsA list of supported keys and keyboard shortcuts
- Arrow keys
For information on editing event parameters, see below.
The File drop-down menu includes the following items:
Run the recorded test.
Note: Use this command to verify the recorded script works correctly. If it does, then you can use it in automated test suites.
The Add drop-down menu includes the following items:
Opens the Script Settings dialog box.
Record more actions
To record more actions and append them to the script:
Locate the baseline item in the list on the Steps tab.
You can record actions and add them to the script after or before:
- existing steps,
- Click events,
- Keyboard input events.
Click and select Record new steps (or Record new events) from the drop-down menu:
In the subsequent dialog, choose whether you want to record a new action before or after the baseline item:
Note: You cannot add a step before the first step.
Click Record and Add. This will replay the script from the beginning until the playback reaches the required point.
Record the needed actions as usual.
Click Playback to run the modified script and see if it works correctly.
Select File > Save on the toolbar to save your changes.
Edit event parameters
To view event parameters, simply expand the event item. Some events provide read-only access to their parameters. Some other support editing.
Think Time and Keyboard Input events
Find the needed event in the list of recorded commands and expand its parameters.
Click next to the parameter, enter a new value, then click Submit.
Tip: To map the value of a Keyboard Input event to an external databank, click Map to External Databank in the dialog.
Click events – Change target
Find the needed event in the list of recorded actions and expand its parameters.
Select the preferable way of identifying the click target on the page.
To command CrossBrowserTesting to select the optimal method of object recognition using its AI capabilities, select the Let AI decide check box.
To enable the AI object identification for the whole script, click on the recorder’s toolbar. In the subsequent dialog, select Let AI decide in the Object identification drop-down list.To specify the target object manually …To specify the target object manually …
… select one of the following options:
Use XPath — The script runner identifies an object in the page’s DOM using an XPath expression that refers to the object's index within the document hierarchy.
For example, the following expression refers a link located in the header of a specific block element://html/body/div/h1/a
Use Optimized XPath — The script runner identifies an object in the page’s DOM using an XPath expression that refers to the object or its parent unique identifier (the
idattribute), where it is possible.
For example, the following expression refers a link located in the header of the
sampleelement, specified by its ID://*[@id="sample"]/h1/a
Use CSS Selectors — The script runner identifies an object in the page’s DOM using a CSS selector.
For example, the following expression refers a link located in the header of a specific block element::nth-child(4) > h1 > a
Use Screen Coordinates — Use
zcoordinates of the object.
The coordinate line consists of two numbers, for example:(95, 105)
The first number refers the
xaxis, the second — the
Click events – Change label
Delete events or steps
Select > Delete next to the step or event you want to delete.
Deleting a step deletes all events in it.
Deleting a keyboard or mouse event also deletes the Think Time command before it.
To rename a script
Renaming is possible only after you stop recording:
Click next to the test’s name (this button is invisible during test recording).
Enter a new name for the script and press Enter to confirm the changes: