How to check value of tooltip in nightwatch
Asked 07 September, 2021
Viewed 2.1K times
  • 55
Votes

I'm writing a test which checks that some text appears when you hover over a link. Currently unable to do this as the DOM doesn't change on hover so there's no element to check. See html below:

<span data-qaid="printAndExport">
   <li title="Some hover text"><a href="" class="disabled" data-qaid="printLink" tabindex="-1"><em class="icon icon-print"></em><span class="disabled">Print</span></a></li>
   <li title="Some hover text"><a href="" class="disabled" data-qaid="exportLink" tabindex="-1"><em class="icon icon-get_app"></em><span class="disabled">Export</span></a></li>
</span>

I've tried an assertion on the link itself but that obviously doesn't work as that'll just return the link text itself instead of the value on hover. The only thing I can think of is to check the title attribute but that's not directly testing the functionality on the WebApp by hovering, its just checking an attribute in the DOM. Any ideas would be much appreciated.

2 Answer