How to verify a tooptip which ist hidden in a div-section?


I’m trying to verify a tooltip in an Angular website. Its not possible to acess this tooltip with the Object Spy.

The tooltip is created via a message-name.

The following part contains the reference to the message --> “cdk-describedby-message-15”

<a class="id_link_label_linkvalue ng-star-inserted" rel="noreferrer" target="_blank" aria-describedby="cdk-describedby-message-15" cdk-describedby-host="" href="https://abcdefg.xy">II/2 </a>

At the end of the DOM there ist a DIV-section with the text of the message named cdk-describedby-message-15.

<div id="cdk-describedby-message-container" aria-hidden="true" style="display:
<div id="cdk-describedby-message-0">Drucken</div>
<div id="cdk-describedby-message-15">Freigabe am: 26.08.2016</div>
<div id="cdk-describedby-message-16">Finalisierung am: 26.09.2016</div>

In my testcase I pick up the message name sucessfully via getAttribute

String msgName = WebUI.getAttribute(findTestObject('Institutsanzeige/FKRPGesamtnote/BBk1'), 'aria-describedby')

In the repository I’ve defined a dummy-object ToolTip1 with object property xpath equals //*[@id="${msgTT}"]

In my testcase I replace the parameter with the message name “cdk-describedby-message-15”

The verifyElementPresent was sucessful

WebUI.verifyElementPresent(findTestObject('Institutsanzeige/FKRPGesamtnote/ToolTip1', [('msgTT') : msgName]), 3)
10-15-2018 10:21:41 AM - [START]  - Start action : verifyElementPresent
10-15-2018 10:21:41 AM - [INFO]   - Finding Test Object with id 'Object Repository/Institutsanzeige/FKRPGesamtnote/ToolTip1'
10-15-2018 10:21:41 AM - [INFO]   - Checking object
10-15-2018 10:21:41 AM - [INFO]   - Checking timeout
10-15-2018 10:21:41 AM - [INFO]   - Finding web element with id: 'Object Repository/Institutsanzeige/FKRPGesamtnote/ToolTip1' located by 'By.xpath: //*[@id="cdk-describedby-message-15"]' in '3' second(s)
10-15-2018 10:21:41 AM - [INFO]   - Found 1 web elements with id: 'Object Repository/Institutsanzeige/FKRPGesamtnote/ToolTip1' located by 'By.xpath: //*[@id="cdk-describedby-message-15"]' in '3' second(s)
10-15-2018 10:21:41 AM - [PASSED] - Object 'Object Repository/Institutsanzeige/FKRPGesamtnote/ToolTip1' is present
10-15-2018 10:21:41 AM - [END]    - End action : verifyElementPresent

Attention! Forum software does not show the whole xpath expression.

But if I try to access the message-text its empty

println(WebUI.getText(findTestObject('Institutsanzeige/FKRPGesamtnote/ToolTip1', [('msgTT') : msgName])))
10-15-2018 10:21:41 AM - [INFO]   - Finding web element with id: 'Object Repository/Institutsanzeige/FKRPGesamtnote/ToolTip1' located by 'By.xpath: //*[@id="cdk-describedby-message-15"]' in '15' second(s)
10-15-2018 10:21:41 AM - [INFO]   - Found 1 web elements with id: 'Object Repository/Institutsanzeige/FKRPGesamtnote/ToolTip1' located by 'By.xpath: //*[@id="cdk-describedby-message-15"]' in '15' second(s)
10-15-2018 10:21:41 AM - [INFO]   - Getting text of object 'Object Repository/Institutsanzeige/FKRPGesamtnote/ToolTip1'
10-15-2018 10:21:41 AM - [PASSED] - Text of object 'Object Repository/Institutsanzeige/FKRPGesamtnote/ToolTip1' is: ''

I’ve also tried two other approaches wich I found in the forum and they are basically working but none of them gives me the messagetext if I use getText.

String newXpath = ('//*[@id="' + msgName) + '"]' 
TestObject new_TT = WebUI.modifyObjectProperty(findTestObject('Institutsanzeige/FKRPGesamtnote/ToolTip1'), 'xpath', 'equals', newXpath, true)
TestObject dynamicObject = new TestObject('dynamicObject').addProperty('xpath', com.kms.katalon.core.testobject.ConditionType.EQUALS, 
            newXpath, true)

Has anyone a hint?

try following on your invisible div:

println WebUI.getAttribute(TO,'textContent')
1 Like

Thanks a lot Andrej! It works. So easy if one knows where to search.


Hi Andrej,
I am getting message as NULL. My tooltip xpath is
note icon

I have created testobject “tooltip_ETS” with the xpath "(//div[text()= " ETS “]//following::img[@mattooltipposition=“above”])[1]” for the above.

* NOT accepting WCCP Chassis * Evergreen chassis should not be dropped at any facility other than Everport * Evergreen export reefer container with Evergreen genset chassis: If not delivering to ETS, have the terminal flip reefer and return genset chassis to ETS

I tried code like below but it has returned NULL
String tt = WebUI.getAttribute(findTestObject(“Object Repository/PORTS/ControlTower/ReturnSignal/tooltip_ETS”), ‘textContent’)
println("tt is: " + tt)
Please help me.

do you get any error?

If you know how to look at the HTML, then you can check which attribute has the text that you are looking for. (For Chrome, hit F12 then right click on the element and select Inspect).

Maybe like:
String tt = WebUI.getAttribute(findTestObject("PORTS/ControlTower/ReturnSignal/tooltip_ETS"), 'title')
WebUI.comment("Tool tip info is ${tt}")
println("tt is: " + tt)

I’m not a great proponent of using arrays as the xpath (only my personal experience). They just seem to get broken with every other release we have. Can you try to find a “safer” path?

I didn’t get any error but returned NULL.


I inspected the XPATH but it does not have attribute title.

Element is:
note icon

Can you show some HTML around the image element? Also, if you manually “hover” over the image element, the tooltip displays? And if it exists, the “title” could be an attribute of the img tag, not of the xpath to get to the tag. So if you review the HTML of the img tag, are there any attributes?

Can you find a Name or ID of another element that is closer to the image element? Maybe somewhere in this area: //div/div/div[1]/img


I guess, you expect that the Katalon Studio (Web Recorder and Spy) tool always gives you 100% correct XPath for you; you expect that the tool is reliable enough.

I would say, no, that isn’t always the case.

I would advise you, you should spend sometime studying the underlying technologies first. See the following article for getting started with XPath.

I guess, the Web Recorder or Spy tool generated it for you. Or you might have got it through Google Chrome’s DevTools. Anyway, I evaluate this XPath expression is terrible. It is too long, too complicated. How can you be sure it is correct? No, you can hardly be confident of it. Even if the expression is correct today, it will easily break sometime in furture once the design of Web page is changed.

The article shows 2 instances of valid XPaths expression:

Absolute XPath


Relative XPath

//div[@class='featured-box cloumnsize1']//h4[1]//b[1]

Both of these XPath expressions in the article are (as author writes) valid and pointing to a single HTML element.

Please note that there could be multiple possible XPath expressions that point to a single HTML element in a HTML. I evaluate that the former XPath is poor, the latter XPath is better. The former one is too long. The latter one is short. The shorter a code is easier to understand, therefore less-error prone.

The auto-generated XPath expressions by the Spy tool are just a candidate to choose out of the many possible expressions. And I would say that an auto-generated XPath is not always the best one. Ideally you should be able to write manually the best XPath expression for yourself.


I would advise you to study the XPath technology by reading the article first. Leave your current issue untouched for a while. Once you have read the article and have got better idea about XPath, turn back to your current issue. With sufficient knowledge, you would be able to find an answer for yourself.

Can any one help to regarding correct xpath as my page contains multiple web objects.


It seems that your problem has nothing to do with the original post “How to verify a tooltip which is hidden in a div-section?”. Therefore you should create a new post for your own problem.

Before you create a post, read the following guidance and provide enough information about your problem.