2

I was to check to see if a text with inline styles exist.

For example page.should have_content(text) works for raw text such as

"Time out",

however it does not work for the text

"Time out. Please <a href=#">Click</a> here to retry".

Also I have been having trouble trying to locate an anchor with inline style as well ex:

<a>click <strong>here</strong>to retry</a>.

Thanks.

Jo Liss
  • 30,333
  • 19
  • 121
  • 170
user_1357
  • 7,766
  • 13
  • 63
  • 106

1 Answers1

2

You are correct that have_content tests for text, not markup. You can do this though:

page.body.should include('... <a>...</a> ...')

Regarding your second question, I don't think it's possible to do page.has_link? with markup. You would have to construct your own XPath expression and then use page.should have_selector(:xpath, '...'). Or test for the raw HTML using page.body of course.

Jo Liss
  • 30,333
  • 19
  • 121
  • 170