How to Use the Web App Simulator?

The following sections will describe in detail on how to record a transaction and configure the Web App Simulation component for monitoring.

How to Record a Transaction?

The Web App Simulation Recorder is a standalone desktop tool that is packaged with the eG agent and is installed on the computer / VM from where the simulation will happen. This is used to simulate the required web transactions and record the entire simulation to be played back at custom intervals later on.

To record a transaction, do the following:

  1. Login to the host on which the eG agent is installed.
  2. Execute the WebAppSimulationRecorder.exe from the <EG_INSTALL_DIR>\lib\Synthetic folder.
  3. Figure 1 will then appear.

    Web App Simulation Recorder

    Figure 1 : The Web App Simulation Recorder

  4. Here, specify the URL of the website using which you wish to record a sequence of transactions to build a script. Let us take http://teleportal.acme.com as an example.

    Entering URL for simulation

    Figure 2 : Entering the URL for simulation

  5. In Figure 2, once you enter the URL, click the Start Recording button. Google Chrome browser opens automatically and the simulator hits the specified URL in Figure 2. Figure 3 will then appear prompting you to start the recording.

    Starting Recording

    Figure 3 : Starting the recording

  6. Click the OK button in Figure 3 to start the recording.

  7. The next step towards building the script is to start the recording. The primary purpose of the recording is to start capturing the user transactions that are to be emulated.
  8. Each activity that you do on the website will be recorded. For example, let us say take the case of recharging a mobile with a pre-paid plan. For this, in our example, we login into the website, ascertain the best pre-paid plan, proceed to recharge by making the payment. These transactions and activity pertaining to the transactions will be recorded in sequence.

    Recording Activity

    Figure 4 : Recording an activity

  9. Figure 4 captures each URL hit on the target web app as a transaction and every action (mouse click, keystroke etc) as an Activity. You can even use the Web App Simulation Recorder to record a transaction/activity where TOTP based two-factor authentication is used for user authentication. To know more on how TOTP based two-factor authentication works with web applications / web sites, refer to How TOTP based Two-factor Authentication Works With Web Applications?.
  10. While you are recording a simulation, you are allowed to verify the page title or a text in the web page. This helps in maintaining a smooth navigation between web pages while replaying the simulation. To verify the page title, right click on the Google Chrome browser and follow the menu sequence: eG Web App Simulation Extension -> Assert Title (see Figure 5).

    Verifying Title of Web page

    Figure 5 : Verifying the title of the web page

    This will ensure that the title of the web page is verified. In our example, the page title is ACME TELCOM (see Figure 5) and the same will be verified while replaying the simulation. This will be added as an activity while performing the simulation (see Figure 6). Similarly, you can even verify a text in the web page. For example, you can verify the Payment Successful message in the web page while performing the simulation.

  11. Once you have performed all the required transactions, you can stop the recording by selecting the Stop Recording button that appears in Figure 6.

    Stopping Recording

    Figure 6 : Stopping the recording

  12. Once you have stopped the recording, you can even replay the recording to verify if you have perfectly recorded the script. For this, press the Play button as shown in Figure 7.

    Clicking Play button to Replay

    Figure 7 : Clicking the Play button to replay the recorded script

  13. You are even allowed to modify / delete a transaction at any point of time. For this, you need to right click on a Transaction. Figure 8 will then appear using which you can provide your own name for that transaction. Note that you are not allowed to delete the very first transaction that you have recorded.

    Editing Transaction

    Figure 8 : Editing a transaction

  14. When you click the Edit Transaction, Figure 9 will appear prompting you to rename the transaction.

    Renaming Transaction

    Figure 9 : Renaming of the transaction

  15. Similarly, you can delete an individual transaction alone or delete the transaction along with the activities performed in the chosen transaction.
  16. You are even allowed to modify / delete an activity too. For this, you need to right click on an Activity and click the Edit Activity option. Figure 10 will then appear using which you can select the Activity and the Target:Value pair of the chosen activity.

    Editing Activity

    Figure 10 : Editing an Activity

    The below table lists the purpose of each Activity in detail.

    Activity

    Description

    Target

    Value

    AssertText

    Asserts an expected page text. Verifies whether the text in the Target location is the same as the Value specified

    The location (XPath) of the text that should be matched against the Value.

    The string that is expected in the Target location specified.

    AssertNotText

    Asserts a page text that is not expected. Verifies whether the text in the Target location does not contain the Value specified

    The location (XPath) of the test should not match against the Value.

    The string that is not expected in the Target location specified.

    AssertTitle

    Asserts an expected page title. Gets the title of a website and checks it against the provided Target text

    The expected title.

    Not applicable

    AssertNotTitle

    Asserts if a page title that is not expected appears. Gets the title of a website and checks it against the provided Target text

    The title should not contain the Target text.

    Not applicable

    ClearandType

    Clears and sets the value of an input field, as though you typed it in.

    The location (XPath) where the Value should be typed.

    The input string to be typed in the Target location.

    Click

    Clicks on an element (button, link, check box etc).

    The location (XPath) of the element to be clicked at.

    Not applicable

    ClickAt

    Moves mouse inside the element in the Target location and clicks it.

    The location (XPath) of the element to be clicked at.

    Not applicable

    CloseWindow

    Closes the tabs and windows

    Index of the tab to be selected. 0 is the main window/tab, 1 the first tab to the right, 2 the second, and so on.

    Not applicable

    DoubleClick

    Double-clicks on the element in the Target location.

    The location (XPath) of the element to be double-clicked.

    Not applicable

    ExitFrame

    Exits the current frame and moves to the top of the web page.

    Not applicable

    Not applicable

    Pause

    Delays the execution of the simulation by a specified time.

    The duration (in secs) of the delay.

    Not applicable

    Scroll

    Scrolls the web page up or down.

    X,Y coordinates of the web page to be scrolled. Example: 0,400.

    Not applicable

    Select

    Selects the specified Value from the element (drop-down/combo box/list box) in the Target location.

    The location (XPath) of the element.

    The value to be selected from the element in the Target location.

    SelectFrame

    Switches to the frame that uses the Target index.

    Pass the frame index. 0 is the first frame, 1 is the frame below it, and so on. For nested iframe, the format is 0,1,2,3,...n. Example: 0 for an iframe (OR) 0,5,2 for a nested iframe.

    Not applicable

    Sendkeys

    The location (XPath) of the element from which the keystrokes have to be sent.

    The location (XPath) of the element from which the keystrokes have to be sent.

    Key or Value to be sent. Refer the table below for the format in which the Value needs to be provided:

    Key Value
    Enter ${KEY_ENTER}
    Escape ${KEY_ESC}
    Tab ${KEY_TAB}
    Delete ${KEY_DELETE} or ${KEY_DEL}
    Backspace ${KEY_BACKSPACE} or ${KEY_BKSP}
    Up Arrow ${KEY_UP}
    Down Arrow ${KEY_DOWN}

    Left Arrow

    ${KEY_LEFT}

    Right Arrow

    ${KEY_RIGHT}

    Home

    ${KEY_HOME}

    End

    ${KEY_END}

    Page Down

    ${KEY_PAGEDOWN}

    Page Up

    ${KEY_PAGEUP}

    Alt

    ${KEY_ALT+*}

    CTRL

    ${KEY_CTRL+*}

    Shift

    ${KEY_SHIFT+*}

    * - Represents a Character or key such as CTRL+c, Alt+Tab, etc.

    Submit

    Submits the element in the Target location.

    The location (XPath) of the element to be submitted.

    Not applicable

    Type

    Sets the value of an input field, as though you typed it in.

    The location (XPath) of the element in which the Value is to be typed.

    The value to be typed in the element in the Target location.

    TypeWithEncrypt

    Sets the Value of an input field, as though you typed it in and encrypts that Value.

    The location (XPath) of the element in which the Value is to be typed.

    The value to be typed in the element in the Target location.

    StoreText

    Gets the text of an element and stores into a variable for later use.

    The location (XPath) of the element that contains text to be stored.

    The name of a variable. Only uppercase letters, digits and underscore (_) characters are allowed.

    StoreValue

    Gets the value of an element and stores into a variable for later use.

    The location (XPath) of the element that contains value to be stored.

    The name of a variable. Only uppercase letters, digits and underscore (_) characters are allowed.

    Echo

    Prints the specified string or variable in log file.

    The value to be printed in log file. Use @{VariableName} format to print the value of a stored variable.

    Not applicable

    GoBack

    Go back to previous page in the browser history. This is exactly similar to what happens when you click on the Back button in your browser, if you have some history in backward direction.

    Not applicable

    Not applicable

    GoForward

    Go back to next page in the browser history. This is exactly similar to what happens when you click on the Forward button in your browser, if you have some history in forward direction.

    Not applicable

    Not applicable

    GoToURL

    Loads a new web page in the current browser window.

    The full URL beginning with HTTP/S of the new web page.

    Not applicable

    AssertFileAvailable

    Assert an expected file's availability Verifies, whether the specified file in Target location is available.

    The absolute path (includes file name) of the file. Also can use wildcard specifiers in file name, e.g., *txt to search files with extension or *.* to search any files in specified location.

    Not applicable

    AssertFileNotAvailable

    Assert an expected file's unavailability Verifies, whether the specified file in Target location is not available.

    The absolute path (includes file name) of the file. Also can use wildcard specifiers in file name, e.g., *txt to search files with extension or *.* to search any files in specified location.

    Not applicable

    AssertDesktopWindowExistByTitle

    Asserts an expected window displayed on the system's desktop with a given title. Enumerates all desktop windows title and verifies whether the text in the target location is present.

    The string that is expected to be present (case insensitive and exact match) on desktop windows title.

    Not applicable

    AssertDesktopWindowNotExistByTitle

    Asserts an expected window not displayed on the system's desktop with a given title. Enumerates all desktop windows title and verifies whether the text in the target location is not present.

    The string that is expected not to be present (case insensitive and exact match) on desktop windows title.

    Not applicable

    CloseDesktopWindowByTitle

    Close the desktop windows by its title. Enumerate all desktop windows and close

    The title (case insensitive and exact match) of desktop window to be closed.

    Not applicable

    CreateFile

    Creates a file at the specified location if not exists and writes given string to the file.

    The absolute path (includes file name) of the file to be created.

    The input string to be written in the file.

    OpenFile

    Opens a file with associated / default application from the specified location.

    The absolute path (includes file name) of the file to be opened. Also can use wildcard specifiers in file name, e.g., *.txt to open latest file with the extension or *.* to open latest file in specified location.

    Choose another application to open file e.g., wordpad.exe to open any text file. (optional)

    DeleteFile

    Deletes a file in the specified location.

    The absolute path (includes file name) of the file to be deleted. Also can use wildcard specifiers in file name, e.g. *.txt to delete files with the extension or *.* to delete any files in specified location.

    Not applicable

    AssertProcessRunningByName

    Asserts an expected process is running on the local computer with given name. Verifies whether the specified process in Target location is running.

    The friendly name (case insensitive and exact match) of the process. It does not include the .exe extension or the path.

    Not applicable

    AssertProcessNotRunningByName

    Asserts an expected process is not running on the local computer with given name. Verifies whether the specified process in Target location is not running.

    The friendly name (case insensitive and exact match) of the process. It does not include the .exe extension or the path.

    Not applicable

    StopProcessByName

    Kill or focus a termination of the specified process(es) running on the local computer by its friendly name.

    The friendly name (case insensitive and exact match) of the process(es) to be stopped. It does not include the .exe extension or the path.

    Not applicable

    CreateOrOverwriteFile

    Creates a file at the specified location or overwrites if already exists.

    The absolute file path (includes file name) of the file to be created or overwritten.

    The input string to be written in the file.

    AssertURLTextAvailable

    Asserts a specified text present on the current page/URL. Gets the site URL and checks it against the provided Target text.

    The string that is expected to be present on the page URL.

    Not applicable

    AssertURLTextNotAvailable

    Asserts a specified text present not on the current page/URL. Gets the site URL and checks it against the provided Target text.

    The string that is not expected to be present on the page URL.

    Not applicable

    AssertVariableValueExist

    Asserts a specified value exists in the stored variable. Verifies whether value of the stored variable in the Target location is same as the value specified.

    The name of a variable. Use @{VariableName} format to validate the value of specified variable.

    The string that is expected to be present in the variable.

    AssertVariableValueNotExist

    Asserts a specified value not exists in the stored variable. Verifies whether value of the stored variable in the Target location is not same as the value specified.

    The name of a variable. Use @{VariableName} format to validate the value of specified variable.

    The string that is not expected to be present in the variable.

    StoreMFAToken(TOTP)

    Time-based One Time Password (TOTP) is a multi-factor authentication method to generate a one-time password (OTP) typically used for authenticating users. Generates TOTP token from the shared secret key and stores into a variable for later use.

    The shared secret key used to generate a one-time password.

    The name of a variable to store the one-time password. Only uppercase letters, digits, underscore (_) characters are allowed.

    EnumDesktopWindows

    Enumerate all desktop windows and print its details in log file. Useful for debugging.

    Not applicable

    Not applicable

    ImplicitClick

    Implicit clicks on an element (button, link, checkboc, etc)

    The location (XPath) of the element to be clicked at.

    Not applicable

    ImplicitType

    Sets the value of an input field, as though you implicitly typed it in.

    The location (XPath) of the element in which the Value is to be typed.

    The value to be typed in the element in the Target location. Use @{VariableName} format to type the value of a stored variable.

    MouseOver

    Moves mouse over (hover) the element in the target location.

    The location (XPath) of the element to be moused over.

    Not applicable

    RefreshPage

    Refreshes the current page as if you have pressed F5 button on the browser.

    Not applicable

    Not applicable

    SelectWindow

    Switches to a browser tab or a window that uses the Target index.

    Index of window/tab to switch to. 0 is the main window/tab, 1 is the first tab to the right, 2 is the second, and so on.

    Not applicable

    WaitForElementDisable

    Wait for a target element to be either disabled or invisible on the page.

    The location (XPath) of the element to be disabled.

    The amount of time to wait (timeout in secs).

    WaitForElementEnable

    Wait for a target element to be either visible or enabled on the page.

    The location (XPath) of the element to be enabled.

    The amount of time to wait (timeout in secs).

    WaitForElementInvisible

    Wait for a target element to be either invisible or not present on the page (DOM).

    The location (XPath) of the element that should be invisible.

    The amount of time to wait (timeout in secs).

    WaitForElementNotPresent

    Wait for a target element Not to be present on the page (DOM).

    The location (XPath) of the element that should not be present.

    The amount of time to wait (timeout in secs).

    WaitForElementPresent

    Wait for a target element to be present on the page (DOM).

    The location (XPath) of the element that should be present.

    The amount of time to wait (timeout in secs).

    WaitForElementVisible

    Wait for a target element to be present on the page (DOM) and visible.

    The location (XPath) of the element that should be visible.

    The amount of time to wait (timeout in secs).

  17. Often, administrators playback the recorded script multiple times before uploading in order to assure that the playback is replayed in the same sequence that was followed while recording the script. If the playback is not in the recorded sequence, they should immediately start troubleshooting the script and identify the exact transaction / user activity that was problematic. For hassle free troubleshooting, administrators can introduce breakpoints on user activities and replay the script. For this, administrators need to right click on the user activity of their choice, navigate to Breakpoint and click the Add option (see Figure 11). This will introduce a Breakpoint on the user activity. To remove, the Breakpoint, administrators can click the Remove option. To resume the playback from the breakpoint, administrators can click the Continue option.

    Adding Breakpoint

    Figure 11 : Adding a Breakpoint

    Once a breakpoint is added to the user activity, a red dot will precede the user activity as shown in Figure 12.

    Identifying Breakpoint with Red dot

    Figure 12 : Identifying a breakpoint with a red dot

  18. Sometimes, administrators may want to add a recorded user activity into another transaction without recording the entire script afresh. For this, administrators can right click the user activity, expand the Options menu and use the Copy, Paste Above and Paste Below options (see Figure 13).

    Copying and Pasting Activity

    Figure 13 : Copying and pasting an Activity

    Administrators can even Cut a user activity from a transaction and paste the same activity in a different transaction(see Figure 14).

    Option to Cut Transaction

    Figure 14 : Option to cut a transaction

  19. Administrators are even allowed to disable a user activity that they do not wish to execute during simulation. To disable a user activity, administrators can right click on that user activity, expand the Options and choose the Disable option (see Figure 15). To enable a disabled user activity, administrators can choose the Enable option.

    Enabling/Disabling Transaction

    Figure 15 : Enabling/Disabling a Transaction

  20. By default, there are certain pre-built settings for the Web App Simulation Recorder. To access these settings, navigate through the Settings -> Recorder Settings menu sequence in the Web App Simulation Recorder. Figure 16 then appears.

    Default Settings Web App Simulation Recorder

    Figure 16 : The default settings available in the Web App Simulation Recorder

  21. The settings mentioned in Figure 16 are explained below:

    • Maximum wait time to perform an activity (Secs): By default, the transactions recorded in the script are replayed in sequence. In the process, during playback or simulation, the maximum wait time to perform an activity in a transaction is set to 30 seconds. This implies that the script will wait for the transaction activity to complete within 30 seconds beyond which will exit the simulation. If you prefer to set the value for this parameter, you can override the default value.
    • Default wait time to perform each activity (Secs): By default, the transactions recorded in the script are replayed in sequence. In the process, during playback or simulation, administrators may want to introduce a time delay before each activity in a transaction is performed. This is because, administrators wanted the simulation to be simulated just like how it was recorded by the user. To this effect, administrators can set a value of their choice against this parameter. The default value is set to 0.
    • Number of playbacks: In order to verify the transactions recorded in the script are replayed in sequence without technical glitch, administrators should playback the recorded script multiple times. To automatically playback the recorded script without manual intervention, administrators can set a specific value against this parameter. For example, setting the value of this parameter to 2 will automatically replay the recorded script twice. By default, this value is set to 1.
    • Playback interval (Secs): By default, this parameter is set to 10 seconds indicating that during consecutive playbacks of the recorded script, there will be a time delay of 10 seconds after a playback is complete and before the next playback commences. If you prefer to set the value for this parameter, you can override the default value.
    • Allow browser to ignore certificate errors: In some environments, transactions recorded in a script may span across multiple web pages. Sometimes, administrators may be unaware of the fact that the SSL certificate of a web page had expired. The lack of SSL certificate for a web page will lead to the failure of the web app simulation in real-time. If administrators want the simulation to succeed irrespective of a web page possessing valid SSL certificate, then, he/she can do so by setting this flag to Yes. By default, this flag is set to No.
    • Allow browser to load default user profile settings: By default, the web app simulation will not load the default browser settings (such as Single Sign-On, Cookies, Bookmarks, History etc) specific to the profile of the user performing the simulation. However, in some environments where Single Sign-On capability is enabled for the user performing the simulation, the simulation may fail after the first attempt. This is because, the login page will not appear during consecutive simulations. To ensure that the simulation succeeds in environments where default browser settings are specific to the user, set this flag to Yes. By default, this flag is set to No.
    • Log level: By default, INFO is chosen from this list. This indicates that whenever the simulation is performed, information level logs are logged for further processing. You can choose to disable the logging activity by selecting the OFF option. You can also enable debug mode by choosing the DEBUG option. If you choose WARNING or ERROR options, the warning messages and error messages (respective to the option chosen) will be logged.
    • Clicking the Reset option will set the default values to the fields mentioned above.
    • Clicking the Update button will effect the changes made. Clicking the Cancel button will cancel the changes made, if any.
  22. Once you have performed all the transactions, export the recorded transactions as a script to the eG manager. To do this, click the Export To eG Manager option that appears when you click the File menu in the Web App Simulation Recorder (see Figure 17).

    Exporting to eG Manager

    Figure 17 : Choosing the Export To eG Manager option for exporting the script

  23. In Figure 18 that appears, specify the following:

    Specifying Credentials to Export the Script

    Figure 18 : Specifying the credentials to export the script

    • Specify the name of the script in the Script Name text box.
    • Specify the IP address or the host name of the eG manager against the IP/Host Name text box.
    • Against the User Name (Script Owner) and Password text boxes, specify the credentials of the user who is authorized to export the script and initiate the simulation process.
    • If the eG manager is SSL-enabled, then set the Protocol flag to HTTPS. If the eG manager is not SSL-enabled, then set the flag to HTTP.
    • Specify the port at which the eG manager listens to against the Port text box.
    • Alternately, if you wish to export the script via a proxy server to the eG manager, select the check box against the Proxy Settings.

      • Specify the IP address or the host name of the proxy server against the IP/Host Name text box.
      • Specify the port through which the communication to the proxy server is established against the Port text box.
    • If the proxy server requires to be authenticated by a user for connecting to the eG manager, then select the check box against the Proxy requires user authentication check box.

      • Specify the credentials of the user who is authorized to access the proxy server against the User name and Password text boxes.
    • If you wish to store the credentials that you have provided for future use, then select the Remember Me check box.
    • Once you have provided all the required credentials, click the Export button.
    • If you wish to abort the operation click the Cancel button.
    • If you wish to reset the credentials that you have entered, then, click the Reset button.
  24. Once the script is exported successfully, a message to that effect will appear as shown in Figure 19.

    Script Exported Successfully

    Figure 19 : Message that appears when the script is exported successfully

  25. If you want to add/modify/delete a transaction in an exported script, eG Enterprise provides an option to import the exported script. For this, click the Import from eG Manager option that is available in the File menu (see Figure 17).

  26. Figure 20 then appears. Specify the following in Figure 20.

    Specifying Credentials to Import Script from eG Manager

    Figure 20 : Specifying the credentials to import the script from eG manager

    • Specify the IP address or the host name of the eG manager against the IP/Host Name text box.
    • Against the User Name (Script Owner) and Password text boxes, specify the credentials of the user who is authorized to export the script and initiate the simulation process.
    • If the eG manager is SSL-enabled, then set the Protocol flag to HTTPS. If the eG manager is not SSL-enabled, then set the flag to HTTP.
    • Specify the port at which the eG manager listens to against the Port text box.
    • Alternately, if you wish to import the script via a proxy server from the eG manager, select the check box against the Proxy Settings.

      • Specify the IP address or the host name of the proxy server against the IP/Host Name text box.
      • Specify the port through which the communication to the proxy server is established against the Port text box.
    • If the proxy server requires to be authenticated by a user for establishing a connection between the eG manager and the machine on which you wish to import the script, then, select the check box against the Proxy requires user authentication check box.

      • Specify the credentials of the user who is authorized to access the proxy server against the User Name and Password text boxes.
    • If you wish to save the credentials for future use, then select the Remember Me check box.
    • Once you have provided the above-mentioned credentials, click the Connect button in Figure 20.
    • Clicking the Connect button in Figure 20 will enable and populate the Script Name list as shown in Figure 21. Choose a script from this list and click the Import button.

      Choosing Script tto Import from eG Manager

      Figure 21 : Choosing the script that you wish to import from the eG manager

    • If you wish to abort the operation click the Cancel button.
    • If you wish to reset the credentials that you have entered, then, click the Reset button.
  27. Once the import is successful, the script will automatically open in the Web App Simulation Recorder.
  28. In case you have recorded only a partial script and wish to save the script in the local machine, then, you can click the Save As option available in the File menu of the Web App Simulation Recorder.

    Saving Script

    Figure 22 : Saving the script

  29. Figure 22 will then appear prompting you to locally save the script. By default, you will be prompted to save the script with a default File name. You can either carry on with that default file name or specify a new file name for the script. By default, the script will be saved in .xml format.