Micro Focus QTP (UFT) Forums
Verify images get properly loaded or not(Broken Images) in respective pages - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: Verify images get properly loaded or not(Broken Images) in respective pages (/Thread-Verify-images-get-properly-loaded-or-not-Broken-Images-in-respective-pages)



Verify images get properly loaded or not(Broken Images) in respective pages - nilanjans - 01-10-2013

Hi,

Suppose in a page we are supposed to have 5 images.(Expected)
How you can make sure that on run time all the images been loaded properly in proper location.(We don't have any broken images on the page)

My view is that you can put bitmap checkpoint to those images so on run time it goes for bit by bit comparison and comes up with appropriate result.
But if there are more number of images (30+) then we need to set bitmap checkpoint for each of the images .
So what can be the way in such case?

Please share you view regarding this situation. Handling the situation using descriptive programming will be helpful.


RE: Verify images get properly loaded or not(Broken Images) in respective pages - nilanjans - 01-11-2013

Hi All

Just adding some more information regarding the situation.

I have created a HTML page that having two images, that i am fetching from my hard drive.
But among these two one of the images does not exist in the drive at all. so when the page gets loaded it shows that it loaded a broken image.
Now Object spying it shows the all the identification properties are same for both the images.But one is loaded and other is not.
How to write script for this situation.
Please help me out.

Thanks in advance.
Nilanjan


RE: Verify images get properly loaded or not(Broken Images) in respective pages - harishshenoy - 01-15-2013

Hi ,

Try to identify the 'X' mark on the broken image , this can solve your problem , then do a negative testing to find the 'x' mark on the page. If found then there is a broken image , if not then everthing is fine..

Thanks,
Harish


RE: Verify images get properly loaded or not(Broken Images) in respective pages - nilanjans - 01-16-2013

Hi Harish,

Yes, your above concept sounds logical.
When images does to get loaded on run time(i.e Broken Images) those come up with "X" mark on page.

But for each and every image how to identify that 'X" mark, because you don't know they will be broken or not on run time. And for Identifying "X" mark which process should we follow. I can think of "Bitmap checkpoints" on "X" marks , but that also have to be given at design time it self.
It will be really helpful if you come up with any scenario and code for that.

Thanks,
Nilanjan.


RE: Verify images get properly loaded or not(Broken Images) in respective pages - nilanjans - 01-17-2013

Hi All,

Finally this code worked for me. Please have a look and let me know if anyone have any suggestion to make it better.

Code:
SystemUtil.Run "C:\Documents and Settings\nilanjans\Desktop\Count Broken Images\Example\BrokenLink.html"

wait(5)

Browser("Creationtime:=0").Sync
wait(3)
Set oDesc=Description.Create()
oDesc("micclass").Value="Image"
oDesc("html tag").Value="IMG"
Set linkCollection=Browser("title:=.*").Page("title:=.*").ChildObjects(oDesc)
msgbox linkCollection.count
brokenImg=0
For i=0 to linkCollection.Count-1
    nativePropertyVal = linkCollection(i).Object.sourceindex
    msgbox  nativePropertyVal'Use the native property in place of sourceindex
'    If StrComp(nativePropertyVal,"4")=0 Then 'Compare the native property value you want to use
       If linkCollection(i).Object.fileSize<=0 then

           msgbox "Image Broken"
           brokenImg=brokenImg+1
           else
           msgbox "Image loaded properly"
       End if
'    End If
Next

Msgbox "Broken Image Count on Page:" &brokenImg

Thanks,
Nilanjan