Verify image present - my solution

I have noticed that a lot of people have problem with the verify image present option. So I fiddled around with it and this is what I discovered:

* make sure that the xpath of the image does not change or if it changes then find it by a rigid neighbor xpath.

* make sure you add your image for comparison like so: https://docs.katalon.com/images/katalon-studio/docs/webui-verify-image-present/define_image.jpg

* now comes the important step- make sure you download the image with the size that it is on the page and use **IT **for comparison, because it is usually resized.

So if you are lazy and haven’t read until the end the most important thing is to **_download the image in the size that it is displayed in on the page and use IT for comparison.

_**example: I upload an image which is 360x452 px. The page then resizes it to 180x226 px. I run the test and it fails. Then I download the resized 180x226 img and use it for comparison. I run the test again and it passes.

3 Likes

Great tip, Todor.

Thanks, Russ! It has come to my attention that the element has to be in view as well, so the page may need to be scrolled for the test to run correctly.

Hi, Todor.

Could you please tell me how to download the resized image? I ended up always getting the original size. Thanks.

Usually when I did it, the resized image downloaded by default, but things may have changed since then. Right now, what I can recommend is using an image resizer (like this one - https://resizeimage.net/).

1 Like