开发者

Capybara, Cucumber, GWT problem asserting the text with inline styles

开发者 https://www.devze.com 2023-02-10 08:50 出处:网络
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

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

"Tim开发者_StackOverflow中文版e 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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消