2

I am trying to capture the text displayed on doing mouse over on a radio button with Descriptive Programming using GetROProperty. If I spy the tool tip text displayed, it is recognizing as WebElement. I tried executing the below code

setToolTip=Browser(strBrowser).Page(strPage).WebElement(strwebElement).GetROProperty("innertext")
MsgBox ToolTip

but i am getting the below error message

"Cannot identify the object "[WebElement] of (of class WebElement.Verify that this Object's properties match an object currently displayed in your application".

If I run the same code by adding the objects to Object Repository I am able to capture the tool tip text using GetROProperty

Is there any other property other than GetROProperty so that I can capture the tool tip text displayed or is there any other way?

Please suggest.

My complete code looks like this. I have also tried the "object.tile" as suggested but still the same Issue.

Browser(strBrowser).Page(strPage).WebRadioGroup(strLogicalName).Select "true"
Browser(strBrowser).Page(strPage).WebRadioGroup(strLogicalName).FireEvent "onmouseover"
set ToolTip=Browser(strBrowser).Page(strPage).WebElement("strWebElement").Object.title

MsgBox ToolTip

Please suggest

Thanks.

Motti
  • 110,860
  • 49
  • 189
  • 262
ajazz
  • 71
  • 1
  • 1
  • 12
  • Actually I forgot to add the code which i was using for doing mouseover 'Browser(strBrowser).Page(strPage).WebRadioGroup(strLogicalName).FireEvent "onmouseover"'. I have also tried the title property but still the same problem exists, QTP is unable to recognizae the WebElement.Please suggest – ajazz Nov 17 '11 at 05:06
  • When you do `FireEvent "onmouseover"` does the tooltip appear? – Motti Nov 17 '11 at 09:12
  • Yes, the tool tip does appear and if i spy it, the tool tip in which the text is displayed is recognized as "WebElement". – ajazz Nov 17 '11 at 10:10
  • I would learn the object in the OR and compare the description it has to the description you're using for descriptive programming. – Motti Nov 17 '11 at 10:19
  • I have tried the same way by learning the objects in the OR and using the same description properties of the object for descriptive programming. Still do not work – ajazz Nov 17 '11 at 10:29
  • That's strange, there should be no difference. Is it possible to use the OR instead of DP then? – Motti Nov 17 '11 at 12:52
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/5099/discussion-between-ajazz-and-motti) – ajazz Nov 17 '11 at 13:14

1 Answers1

2

Native tooltips are actually the title property of an HTML element, so in order to get an element's title you can do Browser("a").Page("b").WebElement("c").Object.title.

However from what you describe it sounds like your problem is in object identification not in getting the property, it could be that the web application you're testing has special javascript that creates a floating HTML element that displays the text. If so it could be that this element isn't created until a specific event happens (probably a mouseover). This can be why QTP can't recognise the object, it doesn't yet exist. If this is really what's happening you should first fire the relevant event on the base HTML element (using QTP's FireEvent method) and then try to work with the tool tip element.

Motti
  • 110,860
  • 49
  • 189
  • 262