0

This doesn't work:

HTML Source:

<p>foo <strong>bar</strong></p>

Robot Test Case:

Page Should Contain    foo bar

How can I write a test that searches for text without having to care about text formatting tags (em, strong, span, et al.)? Do I have to use XPath?

Christopher Parker
  • 4,541
  • 2
  • 28
  • 33
  • Similar question, using Selenium and not Robot Framework: http://stackoverflow.com/questions/36738799/locate-element-which-contains-visible-text-ignoring-formatting-tags. I'd rather avoid having to use XPath if at all possible, because it makes the test cases more difficult to maintain for less-savvy testers. – Christopher Parker May 19 '16 at 13:24
  • 1
    For reference, this XPath-based locator works in my case: `Page Should Contain Element xpath=(//*[normalize-space(.)='foo bar'])` – Christopher Parker May 19 '16 at 13:52
  • It's either XPath or custom library. XPath is better – jim May 19 '16 at 14:18
  • You might be able to do something like this: ${text}= Get Text css=body Should Contain ${text} foo bar – ombre42 May 24 '16 at 14:24

0 Answers0