Sahi Documentation

Getting the text of a tool tip

Here is how you can get the text of a tool tip.
  1. Identify the tool tip manually through the controller. It may be some div, for example.
  2. In your script, now you can do the following.
    1. Do a _mouseOver(element) to view the tooltip div.
    2. Do a getText() of the tooltip div to get the tooltip text.
Example:
_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 Alternatives: dropdown which will not change.

Example: We have used _div("ui-tooltip-content") above, where ui-tooltip-content is the class name.