Recording synthetic scripts

Record a synthetic script by using the Firefox web browser and the Selenium IDE add-on. With Selenium IDE, you can record user actions on a web page, such as loading a page, clicking a link, or selecting an object. When Selenium IDE is recording, it generates a command for each user action in a script. Then, using Synthetic Script Manager, you can configure scripts to simulate user behavior at your website, at set intervals and at different locations.

Before you begin

You must use the Firefox web browser when recording scripts
Selenium IDE is available only as a Firefox add-on. If Selenium IDE is not installed or running, complete the following steps:
  1. Ensure that you are running a version of Firefox 60 or later that supports Selenium IDE 3.2.X or 3.3.X. If you have a later version of Selenium IDE, it is not supported; you must uninstall it and install version 3.2.X or 3.3.X.
    Note: By default, Selenium IDE is automatically updated after you install version 3.2.X or 3.3.X. Turn off automatic updates for Selenium IDE to prevent version upgrades.
  2. Download and install Selenium IDE 3.2.X or 3.3.X from the Selenium home page (https://addons.mozilla.org/firefox/addon/selenium-ide/versions/). Allow Selenium IDE to install all plug-ins.
  3. After Selenium IDE is installed, restart Firefox.
  4. Navigate to the web page that you want to test and close any other tabs. To open Selenium IDE, click Tools > Selenium IDE. In the Selenium IDE window, ensure that the Base URL field contains the URL of the displayed web page. Selenium IDE starts recording all user actions on the displayed web page.
Selenium .side script format

Scripts created with newer versions of Selenium use the ..side format. With Selenium IDE 3.2.X or 3.3.X, you can import older scripts that were created with the .html format and save to the .side format. For more information, see Updating scripts from earlier Selenium IDE versions.

If you will be using Selenium .side scripts, you must first install these updates:
  • IBM Cloud Application Performance Management V8.1.4.0 Synthetic Playback agent Interim Fix 5 or later on the systems where you installed the Synthetic Playback agent.
  • Contact IBM to ensure your Cloud APM subscription has been updated to IBM IBM Cloud Application Performance Management, Private Cloud APM V8.1.4.0 Server Interim Fix 8 or later.
  • If you are using an Availability Monitoring private point of presence (PoP), check that the synthetic PoP build number is APM_201903090832 or later by entering the cat build.info command from the PoP installation directory. Earlier build versions do not support .side format.
Interim fixes for Cloud APM V8.1.4.0 are available to download from IBM Support > Fix Central > IBM APM 8.1.4.0.

About this task

In this task, you perform user actions on a web page and use Selenium IDE to record these actions as commands in a simple script. You can use scripts to monitor the performance and availability of your web application in the Application Performance Dashboard.

Procedure

Complete the following steps to record a script of user actions on a web page:

  1. Click Record to start recording a script. Perform user actions on your web page, such as clicking a link.
    For every user action on a web page, Selenium IDE records a command and adds it to a script.

    For example, complete the following actions to record when a user loads the IBM Marketplace web page and navigates to a free trial of Cloud APM, in a script:

    Table 1. Recorded user actions and Selenium IDE commands
    User action Commands added to script
    To record when the Cloud APM web page on the IBM Marketplace website opens, open the IBM Marketplace web page. Right-click anywhere on the displayed web page and select open. open
    To ensure that the script checks that the web page loads, right-click the title text of the web page (IBM Cloud Application Performance Management) and click Show All Available Commands > verifyTitle IBM Cloud Application Performance Management. verifyTitle
    To record when the user clicks a link to view details about Cloud APM, click the Details link. The Details page loads. clickAndWait
    To ensure that the script checks that the Details page has loaded, right-click on the Feature spotlights heading and select Show All Available Commands > verifyText css=h2.heading--TERTIARY. verifyText
    To record when the user clicks a link to view details about how to purchase Cloud APM, click the Purchase link. The Purchase page loads. clickandWait
    To record when the user clicks a button to register for a free trial of Cloud APM, click the Try Free button. click
  2. In the Selenium IDE window, click Record to stop the recording. Click the Save Project tool, give your script a meaningful name, and save as a .side file (such as open_webpage.side).
  3. In the Selenium IDE window, review your recorded script. Click the Table tab to display the script in a table format. In the Selenium IDE window, click Play Current Test Case to test the playback of the script that you recorded.

    In this example, Selenium IDE displays the script of user actions on the IBM Marketplace website, as described in step 1.

    Table 2. Example of a Selenium IDE script recording of user actions on the IBM Marketplace website
    Command Target Value
    open /  
    verifyTitle IBM Cloud Application Performance Management  
    clickAndWait css=ul > #details > a  
    verifyText css=h2.heading--TERTIARY Feature spotlights
    clickAndWait css=ul > #purchase > a  
    click link=Try Free  

Results

You recorded a script that you can use to monitor the performance and availability of a web application.

What to do next

If you recorded a complex script, you can organize your script into simpler scripts, where each script represents a specific business process or user action on your web application. For more information, see Structuring complex scripts.

Use the Synthetic Script Manager to upload your script file to a new or existing synthetic transaction. For more information, see Creating and editing a synthetic transaction.