I attempted to utilize driver.mouse().move(element.getLocator()).go();
in order to simulate mouse hovering and obtain the tooltip value. Unfortunately, this approach was unsuccessful as the tooltip div tag failed to populate. The error message I encountered was org.graalvm.polyglot.PolyglotException: cannot find locator
.
I am currently using karate version 1.4.0
.
I tried this for the live example you provided and it worked:
* driver 'https://material.angular.io/components/tooltip/overview'
* mouse().move('tooltip-overview-example .mat-mdc-button-touch-target').go()
Please do go through the documentation in detail, it can help: https://github.com/karatelabs/karate/tree/master/karate-core#mouse
Personally I feel a test trying to get the tooltip is a waste of time. Visual testing may need to be considered.
I was able to get the tooltip value like this:
* def tip = attribute('tooltip-overview-example button', 'mattooltip')
* match tip == 'Info about the action'