LoadRunner – Image Check

As the name specified, an image check is used to verify the presence of the image in the response coming from the server on a particular page. Text check is often used to verify the presence of a particular word or string on the web page whereas image check verifies the image content only. It is a good practice to have either a text check or an image check for each web page in the script. In the previous article, you read about how to add a text check? This article covers Image Check insertion in the LoadRunner script.

Remember: Text check can be added while recording and after recording, but image check is added only after the recording. There is no such option to add image check during the recording of the script.

How to add an image check after recording in the LoadRunner script?

1. To add an image check in the script you must know about the alt or src attribute of the image on the web page. To get the alt or src attribute of the image, follow the below steps:

a. Open the web page in the browser
b. Right-click on the image
c. Click ‘Inspect’ (in Chrome) / ‘Inspect element’ (in Internet Explorer and Firefox)

LoadRunner Image Check - Web Tour
Figure 01: ‘Inspect’ option in Chrome
Figure 02: ‘Inspect Element’ option in Mozilla

d. Copy either the alt or src value. Refer to the below screenshot in which the alt value is blank, so the src value ‘image/webtours.png’ needs to be copied. You need anyone value from them.

Figure 03

2. Go to the Vuser script.

3. In the Editor, locate the position where you want to insert the image check.

4. Go to Menu then Select View -> Steps Toolbox (or Press Ctrl+Alt+B) to open the Steps Toolbox.

5. In the Steps Toolbox, type ‘web_image_check’.

6. The search result will show you the ‘web_image_check’ function. Double-click on it.

7. Enter the alt or src value in the ‘Image Check Properties’ dialogue box.

LoadRunner Image Check - Function
Figure 04: Insert Image Check

8. Click ‘OK’ to insert the function in the Vuser script.

LoadRunner Image Check - Function
Figure 05: web_image_check function

Note:

Check the ‘Enable image and text checks’ before replaying the script. 

Runtime Settings -> Internet Protocol -> Preferences -> Checks -> Enable image and text checks

LoadRunner Content Check - Image Check Runtime Settings
Figure 06: LoadRunner Runtime Settings

3 thoughts on “LoadRunner – Image Check”

Leave a Comment