Getting the text of a tool tip
Here is how you can get the text of a tool tip.- Identify the tool tip manually through the controller. It may be some div, for example.
-
In your script, now you can do the following.
- Do a _mouseOver(element) to view the tooltip div.
- Do a getText() of the tooltip div to get the tooltip text.
_navigateTo("http://jqueryui.com/tooltip/");
_mouseOver(_textbox("age")); // To view tooltip of age textbox.
_alert(_getText(_div("ui-tooltip-content"))); // We identified the div by quick mouse over on the tool tip.
info
Note that the tooltip div will be identified by the visible text (its content) by default.
Given that the tooltip content is what we want to get, and that it can change, we need to use an alternative from the
Example: We have used _div("ui-tooltip-content") above, where ui-tooltip-content is the class name.
Given that the tooltip content is what we want to get, and that it can change, we need to use an alternative from the
Alternatives:
dropdown which will not change.
Example: We have used _div("ui-tooltip-content") above, where ui-tooltip-content is the class name.