Wait for ImgTag to load

Ask general questions here.
johnsmith
Posts: 18
Joined: Sun Mar 18, 2012 2:13 am

Wait for ImgTag to load

Post by johnsmith » Sun Mar 18, 2012 5:43 pm

Hello,

I have a webpage with an image. The image takes some time to load (around 1-2 seconds).

Is it possible to somehow validate that the image is loaded?

Right now the only safe option for me is to wait with Delay.Duration (5000)

Validate.Exists on the adapter always returns true. It seems to me, the reason is that the webpage itself is loaded before the image.

Thank you!

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Wait for ImgTag to load

Post by Support Team » Mon Mar 19, 2012 2:34 pm

Hi,
johnsmith wrote:Is it possible to somehow validate that the image is loaded?
Yes it is possible but you have also to improve the html code. If the html tag has an attribute like
onload="this.loaded=true;"
then you can use Ranorex to validate if this attribute is set to true.

Regards,
Peter
Ranorex Team
.
Image

johnsmith
Posts: 18
Joined: Sun Mar 18, 2012 2:13 am

Re: Wait for ImgTag to load

Post by johnsmith » Mon Mar 19, 2012 5:52 pm

What I ended up doing is I captured a screenshot of a blank element and was waiting for it to go away.