Wednesday, March 11, 2009

How to Capture ToolTips

Hi All,

Here I am providing fews ways of capturing the Tooltips of objects such as Links,Images,Web Elements So on So forth...

For Example, consider the above page. Here we will capture the Tooltip of the Webelement "Google India" shown in below fig.



' ToolTips for Web Elements:
msgbox browser("Google").Page("Google").WebElement("India").Object.title

OutPut :
In the similar way, check out the below ways of capturing ToolTips for other Object Classes too.
' ToolTips for images :
msgbox Browser("Yahoo! India").Page("Yahoo! India").Image("Click here").GetROProperty("alt")

' ToolTips for Links :
x=Browser("Yahoo! India").Page("Yahoo! India").Link("All Yahoo! Services").GetROProperty("OuterHtml")
temp=split(x,chr("34"))
ToolTip=temp(1)
msgbox ToolTip

2 comments:

  1. Nice Explanation...

    ' ToolTips for Links : x=Browser("Yahoo! India").Page("Yahoo! India").Link("All Yahoo! Services").GetROProperty("OuterHtml") temp=split(x,chr("34")) ToolTip=temp(1) msgbox ToolTip


    I have small doubt on above code...
    I have observed few areas about this chr("34")...

    e.g.

    dim x
    set x=createobject("Wscript.shell")
    x.run chr(34) & "path of application " & chr(34)

    set x=nothing

    What exactly (chr(34))it is?

    thanks & regards
    Baba Fakruddin.D
    bfakruddin.d@gmail.com

    ReplyDelete
  2. Hi ,

    'Chr' is function which Returns the character associated with the specified ANSI character code.

    Chr(34) means ---> "

    Somtimes we may face some difficulty with " for retreieving/Splitting the strings.

    So to minimize these type of issues with " , we can use these chr(34) instead of ".

    ReplyDelete