Ad Home

Theme images by kelvinjay. Powered by Blogger.


Header Ads





General QA Concept


» » How to Capture ToolTips or Alt Property of an Image Through QTP

I was in a project where there was a peculiar requirement to capture tool tips through script. I got several request also to write a code which will capture the tool tips. I tried with Google!! I got a very nice thread of motevich. I found this is a great solution. This also solves the problem of capturing the alt property of the Image.Here is a solution for capturing Tooltips of image.Even in my project I have used this code only.

Dim descImage, listImages, attrAltText, attrSrcText

Browser("Main Page - Wikipedia,").Sync
Browser("Main Page - Wikipedia,").Page("Main Page - Wikipedia,").Sync

' Create description for all images on a Web page.
' For that we use "html tag" property and its value "IMG"
Set descImage = Description.Create
descImage("html tag").value = "IMG"

' Get all images which match the above description
Set listImages = Browser("Main Page - Wikipedia,").Page("Main Page - Wikipedia,").ChildObjects(descImage)

' Check tool tips of images
For i = 0 To listImages.Count - 1
attrAltText = listImages(i).GetROProperty("alt")
attrSrcText = listImages(i).GetROProperty("src")

If attrAltText <> "" Then
MsgBox "Image src: " & attrSrcText & vbNewLine & "Tool tip: " & attrAltText
End If

This code is taken from the below written blog.
Credit goes to the owner of this can refer this blog for further query.

Newer Post
Older Post

No comments:

Leave a Reply