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)
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.
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.
8. Click ‘OK’ to insert the function in the Vuser script.
Check the ‘Enable image and text checks’ before replaying the script.
Runtime Settings -> Internet Protocol -> Preferences -> Checks -> Enable image and text checks