Using the web_image_find and web_find functions
The web_find and web_image_check functions are context sensitive statements that is used to verify the presence of a specified text or image inside an HTML page.
Requirements:
1. This function is only supported for HTML-based scripts. It does not work for URL-based scripts.
2. After adding the statement into a HTML-based script, you will need to enable relevant settings in the Run-Time Settings for it to work. To enable this:
a. Go to the Run-Time Settings.
b. Go to Internet Protocol: Preferences.
c. Select the "Enable Image and Text Check" checkbox.
Known Limitations and Work-arounds:
1. Web_find and web_image_check will always throw an error if the text/image is not found.
- If you need to set the error when the text is found, use the web_reg_find function with the "Fail=Found" option.
Example:
web_reg_find("Text=Error", "Fail=Found", LAST); - If you do not want LoadRunner to issue an error regardless of the condition, use the web_reg_save_param function with the "Notfound=warning" option.
Example:
web_reg_save_param("NameCheck", "LB=Welcome", "RB=To Mercury","Notfound=warning", LAST);
2. Web_find and web_image_check do not tell you the number of occurrences of the text/image. To find out this information, you will need to use the web_reg_find function with the "SaveCount=param_name" option.
Example:
web_reg_find("Text=MERCURY", "SaveCount=mercury_count", LAST);
3. Web_find and web_image_check are only for HTML-based scripts. For URL-based scripts, use the web_reg_find function