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.

    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.

    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.

    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.

    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.
  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).

    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.

    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.

    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.

    Figure 8 : Editing a transaction

  14. When you click the Edit Transaction, Figure 9 will appear prompting you to rename the 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.

    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.

    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

    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}

     

    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.

  17. 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 5 then appears.

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

  18. The settings mentioned in Figure 11 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.
    • 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.
  19. 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 12).

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

  20. In Figure 13 that appears, specify the following:

    Figure 13 : 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.
  21. Once the script is exported successfully, a message to that effect will appear as shown in Figure 14.

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

  22. 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 12).

  23. Figure 15 then appears. Specify the following in Figure 15.

    Figure 15 : 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 15.
    • Clicking the Connect button in Figure 15 will enable and populate the Script Name list as shown in Figure 16. Choose a script from this list and click the Import button.

      Figure 16 : 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.
  24. Once the import is successful, the script will automatically open in the Web App Simulation Recorder.
  25. 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.

    Figure 17 : Saving the script

  26. Figure 17 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.