RBM - Advanced Script Editing

RBM - Advanced Script Editing


The Real Browser monitor records and saves the user actions in a web script. These powerful scripts act as a means to measure the web performance via a real browser simulation. The scripts describe actions like mouse clicks, validations, navigation and more. You can update the existing web script actions using our inline client web script editor (Monitor Details -> Edit playback script)

Following are the various commands that are used to update the web script

Every parameter in a command is mandatory. However, for the parameter DISPLAY_NAME, you can pass an empty value between double quotes while maintaining the defined format for each command.
  1. Create a Step

    1. Commandbegin_step("<STEP_NAME>","<STEP_URL>")
    2. Example:
      1. begin_step("Step - 1 : Loading - https://manageengine.com","https://manageengine.com")
      2. begin_step("Step - 2 : click SPAN","https://www.manageengine.com/")
  2. Open a web page

    1. Command: load_page("<URL>")
    2. URL should be the base Base_URL to start a transaction.
    3. Example:
      1. load_page("https://manageengine.com")
  3. Wait for the page to load

    1. Commandwait_for_page_to_load()
    2. This command helps you to ensure that the HTML DOM content and jQuery requests are loaded.
    3. This has to be included after every action which involves URL change and after every step.
  4. Verify the page status

    1. Command:verify_page_load_status()
    2. This command helps you to verify whether the page has loaded or not using the status code.
    3. This has to be included after every action which involves URL change and after every step.
  5. Specify authentication credentials

    1. Command: set_auth_credentials("HOST:PORT", "USERNAME" ,"PASSWORD")
    2. The first parameter will be the "host: port" of the URL for which the Credential is required. Sometimes the website might be using default ports (such as 80 for HTTP and 443 for HTTPS). In those cases, having the complete hostname as the first parameter is enough.
    3. When site with basic authentication is recorded, the playback script should have the this line in the beginning of the script.
    4. Example:
      1. set_auth_credentials("manageengine:8443", "appmanager" ,"apm@123")
DISPLAY_NAME for internal use. It is an optional field and you can pass an empty value between double quotes.
INTELLIGENT_PLAY_CANDIDATES - INTELLIGENT_PLAY_CANDIDATES contains identifiers of an element and can be used to access a particular element. If an identifier fails, the element can still be accessed using the remaining available identifiers. Different types of element identifiers should be separated by the #SEP# delimiter and different XPath's should be separated by the #XPATH# delimiter
Syntax:
#SEP#id=<ELEMENT_ID>#SEP#name=<ELEMENT_NAME>#SEP#linktext=<ELEMENT_LINKTEXT>#SEP#css=<ELEMENT_CSS>#xpath=<ELEMENT_XPATH_1>#XPATH#<ELEMENT_XPATH_2>#XPATH#<ELEMENT_XPATH_3>#XPATH##SEP#
  1. Click an Element

    1. Command: click_element_by_id/name/linktext/css/xpath("<ELEMENT_ID/NAME/LINKTEXT/CSS/XPATH>","<DISPLAY_NAME>","<INTELLIGENT_PLAY_CANDIDATES>"
    2. ELEMENT_ID should be given as the first parameter in case of click_element_by_id, ELEMENT_NAME in case of click_element_by_name and respectively for other properties.
    3. Example:
      1. click_element_by_id("appmanager", "disp_apm", "#SEP#id=appmanager#SEP#name=appmanager#SEP#linktext=APPMANAGER#SEP
        #css=#topmenu>li>a#SEP#xpath=//a[contains(text(),'APPMANAGER')]#XPATH#//ul[@id='topmenus']/li/a#XPATH#//a[contains
        (@href, 'appmanager.html')]#XPATH#//tr[2]/td/ul/li/a#XPATH##SEP#")
      2. click_element_by_id("appmanager", "", "#SEP#id=appmanager#SEP#name=appmanager#SEP#linktext=APPMANAGER#SEP
        #css=#topmenu>li>a#SEP#xpath=//a[contains(text(),'APPMANAGER')]#XPATH#//ul[@id='topmenus']/li/a#XPATH#//a[contains
        (@href, 'appmanager.html')]#XPATH#//tr[2]/td/ul/li/a#XPATH##SEP#")
  2. Double click on an element

    1. Command: double_click_by_id/name/linktext/css/xpath("<ELEMENT_ID/NAME/LINKTEXT/CSS/XPATH>","<DISPLAY_NAME>","<INTELLIGENT_PLAY_CANDIDATES>")
    2. ELEMENT_ID should be given as first parameter in case of double_click_by_id, ELEMENT_NAME in case of double_click_by_name and respectively for other properties.
    3. Example:
      1. double_click_by_id("appmanager", "disp_apm", "#SEP#id=appmanager#SEP#name=appmanager#SEP#linktext=APPMANAGER#SEP
        #css=#topmenu>li>a#SEP#xpath=//a[contains(text(),'APPMANAGER')]#XPATH#//ul[@id='topmenus']/li/a#XPATH#//a[contains
        (@href, 'appmanager.html')]#XPATH#//tr[2]/td/ul/li/a#XPATH##SEP#")
  1. Mouseover an element

    1. Command: mouse_over_by_id/name/linktext/css/xpath("<ELEMENT_ID/NAME/LINKTEXT/CSS/XPATH>","<DISPLAY_NAME>","<INTELLIGENT_PLAY_CANDIDATES>")
    2. ELEMENT_ID should be given as the first parameter in case of mouse_over_by_id, ELEMENT_NAME in case of mouse_over_by_name and respectively for other properties. Both click element and mouseover takes the same parameters; only the function name changes.
    3. Example:
      1. mouse_over_by_id("appmanager", "disp_apm","#SEP#id=appmanager#SEP#name=appmanager#SEP#linktext=APPMANAGER#SEP
        #css=#topmenu>li>a#SEP#xpath=//a[contains(text(),'APPMANAGER')]#XPATH#//ul[@id='topmenus']/li/a#XPATH#//a[contains
        (@href, 'appmanager.html')]#XPATH#//tr[2]/td/ul/li/a#XPATH##SEP#")
  1. Enter value inside an input field

    1. Commandset_text_by_id/name/css/xpath("<ELEMENT_ID/NAME/CSS/XPATH>","<TEXT_VALUE>","<DISPLAY_NAME>","<INTELLIGENT_PLAY_CANDIDATES>")
    2. ELEMENT_ID should be given as the first parameter in case of set_text_by_id, ELEMENT_NAME in case of set_text_by_name and respectively for other properties.
    3. TEXT_VALUE is the value that is to be entered in the text field. 
    4. Example:
      1. set_text_by_id("username", "appmanager", "disp_username", "#SEP#id=username#SEP#name=username#SEP#css=
        #username#SEP#xpath=//input[@id='username']#XPATH#//form[@id='login']/div/div/input#XPATH
        #//input#XPATH##SEP#")
  2. Enter Password

    1. Commandset_password_by_id/name/css/xpath("<ELEMENT_ID/NAME/CSS/XPATH>","<PASSWORD>","<DISPLAY_NAME>","<INTELLIGENT_PLAY_CANDIDATES>")
    2. ELEMENT_ID should be given as the first parameter in case of click_element_by_id, ELEMENT_NAME in case of click_element_by_name and respectively for other properties.
    3. PASSWORD - the password that needs to be entered in the password field.
    4. Example:
      1. set_text_by_id("password", "password@123", "disp_password", "#SEP#id=password#SEP#name=password#SEP#css=
        #password#SEP#xpath=//input[@id='password']#XPATH#//form[@id='login']/div/div/input#XPATH
        #//input#XPATH##SEP#")  y
  3. Select a frame before performing an action

    1. Commandsselect_frame_by_id/name/index/src("<FRAME_ID/NAME/INDEX/SRC>")
      select_frame("relative=up") - for moving back to top frame from the specific frame.
    2.  Use select_frame("relative=up") to move back to parent frame after performing any action inside child frame.
    3. Example:
      1. select_frame_by_id("topframe")
  4. Select parent window

    1. Command: selectMainWindow()
  5. Select a window before performing an action

    1. Commandselect_window_by_name/title/index("<WINDOW_NAME/TITLE/INDEX>")
    2. Example: 
      1. select_window_by_name("window1")
  6. Close a window

    1. Commandsclose_window_by_name/title/index("<WINDOW_NAME/TITLE/INDEX>")
      close_window() - closes the last selected window
    2. WINDOW_NAME/TITLE/INDEX used here will be the one that you have used in select_window.
    3. Example:
      1. close_window_by_name("window1")
  7. Pause for a specific time

    1. Command: wait(<TIME_IN_MILLISECONDS>)
    2. Time should be specified in milliseconds.
    3. Example:
      1. wait("4000")
  8. Verify the presence of text in a webpage

    1. Commandassert_text_present("<TEXT>", "<true/false>")
    2. <TEXT> - Text content that needs to be verified for the presence in the webpage.
    3. The second parameter will accept only boolean (true/false) values, based on which Applications manager decides whether to proceed with further steps or not, when the content check operation fails.
    4. Example:
      1. assert_text_present("Applications", "true")      -> This script checks if the word 'Applications' is present and continues to the next step even if the word is not present.
      2. assert_text_present("Applications", "false")      -> This script checks if the word 'Applications' is present and continues to the next step only if the word is present.
  9. Verify the absence of text in a webpage

    1. Commandassert_text_not_present("<TEXT>", "<true/false>")
    2. <TEXT> - Text content whose absence needs to be verified in the webpage.
    3. The second parameter will accept only boolean (true/false) values, based on which Applications manager decides whether to proceed with further steps or not, when the content check operation fails.
    4. Example:
      1. assert_text_not_present("Applications", "true")      -> This script checks if the word 'Applications' is absent and continues to the next step even if the word is present.
      2. assert_text_not_present("Applications", "false")      -> This script checks if the word 'Applications' is absent and continues to the next step only if the word is absent.
  10. Check the title of the current webpage

    1. Command: assert_title(<TITLE>)
    2. Example:
      1. assert_title("Applications Manager")
  11. Specify confirmation of alert box

    1. Commandassert_confirmation("<ALERT_BOX_MESSAGE>")
    2. Example:
      1. assert_confirmation("Do you want to log out?")
  12. Confirm alert box

    1. Commandassert_alert("<ALERT_BOX_MESSAGE>")
    2. Example:
      1. assert_alert("Do you want to log out?")
  13. Specify the text in prompt box

    1. Command: answer_on_next_prompt("<PROMPT_TEXT>")
    2. Example:
      1. answer_on_next_prompt("Appmanager")
  14. Wait for an element to load

    1. Commandwait_for_element_presence(<element type>,<element name>,<maximum wait time in seconds>)
    2. The wait_for_element_presence function waits for the element to be present before interacting with it. It helps to prevent errors that might occur if your script tries to interact with an element that is not yet loaded to the user.
    3. Example:
      1. wait_for_element_presence("id","country_code","40")
  15. Wait for an element to be visible

    1. Commandwait_for_element_visibility(<element type>,<element name>,<maximum wait time in seconds>)
    2. The wait_for_element_visibility function waits for the element to become visible before interacting with it. It helps to prevent errors that might occur if your script tries to interact with an element that is not yet visible to the user.
    3. Example:
      1. wait_for_element_visibility("id","country_code","40")

                  New to ADSelfService Plus?

                    • Related Articles

                    • RBM - Steps to perform Test Playback

                      What is Test Playback? Applications Manager's Real Browser Monitor works based on a playback script that is created during the monitor creation or recording of the transactions. This playback script will contain Locators to locate the HTML elements ...
                    • RBM - Configure Content Check using Playback Script

                      Related topic: Check out this link if you want to configure content check through the Chrome Extension (Web Transaction Recorder). Content Check option Applications Manager's Real Browser Monitoring allows to configure content check to be done on the ...
                    • RBM - FAQs

                      1. I am unable to create a new RBM monitor. Go to the Support tab and check the license Information. Verify if "EUM Add-on" option is enabled. If it is not enabled, contact sales@manageengine.com to purchase/trial the Add-on since RBM requires the ...
                    • RBM - Enabling the Playback using Microsoft Edge browser

                      Note: Please note that playback using the Microsoft Edge browser is possible only in a Windows server with Microsoft Edge installed on it Please find the below steps to enable the Playback using Microsoft Edge in an EUM Agent: Download the EUM Agent ...
                    • Script/Custom Monitors - Alarms configured for Table rows were missing

                      In the Applications manager , users have the ability to manage the table rows of a script or custom monitor type according to their specific requirements. This can be done by enabling the "Enable Script Row Deletion" option. For example, let's ...