LoadRunner – Image Check

LoadRunner Image Check

As the name specified, 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 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 image check after recording in LoadRunner script?

1. To add an image check in the script you must know about alt or src attribute of the image on the web page. To get 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 alt or src value. Refer to the below screenshot in which alt value is blank, so src value ‘image/webtours.png’ need 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 ‘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

2 Responses

  1. Pradeep says:

    How to write a script for minimum cost value selection in the given option.can you explain the script .

    • PerfMatrix says:

      Hi Pradeep,

      You can follow the steps given in the below article:
      Article Link

      The step by step implementation of the process will help to create a quick and bugfree script.

Leave a Reply

Your email address will not be published. Required fields are marked *