Robot can't get element content although its on the screen

I want to verify this text appears on a web page, should be easy:

<div _ngcontent-ng-cli-universal-c98="" class="figure-caption">MY-IMG-TEXT</div>

This is the script:

 Sleep    10s
Wait Until Page Contains    MY-IMG-TEXT

…but I’m getting: fail even though the text is there on the screenshot

FAIL Message: Text ‘MY-IMG-TEXT’ did not appear in 5 seconds.

The App is written in Angular 12 but other elements are being detected ok. I’m not using any particular Angular library and don’t really want to have to install custom one if possible.

Python 3.7.8
requests                               2.26.0
robotframework                         4.1.1
robotframework-extendedrequestslibrary 0.5.5
robotframework-pythonlibcore           3.0.0
robotframework-seleniumlibrary         5.1.3
selenium                               4.0.0
urllib3                                1.26.7

If you have not already tried, one thing to check is to make sure those are hyphens and not some sort of unicode hyphens or dash. Dashes and hyphens

Hi, thank you I’ve tried using \x2d still does not recognize the text. The original text is this:

Fig. 1 - My Figure Description - Top View

I would check the log.html as page should contain should have the full html code of the page. If it is not there by default, you may need to increase the loglevel to either DEBUG or TRACE. That would give you a chance to double check the text even though you see it there visually.

1 Like

I have discovered an extra white space in the text that is causing the issue. Thank you for your help.