capybara - Test if text does not contain any HTML -
I have to test whether there is no HTML in some content or not, what is a simple and clean way of doing this ?
Page.Fund ("Details"). Should_not has_content /\<.**>/ does not work properly, because it is & amp; Amp; the lift; & Amp; ATM; Fails on , but & lt; Strong & gt; Homepage Possibly the way in which Captara helps its user to avoid HTML. Working with Xpath, but leaving me to think that there is no easy solution.
Page Is there no idea that some text has been stripped from HTML? In Capepara
Cepepara has is_sign? The purpose of the (and thus has_content ) method is to check the text of the user, not the text in the html source of an element as you expect. In this way, I think the captain's behavior is correct:
- If
.description is the html source & amp; LT; Strong & amp; Gt; Homepage , then user & lt; Strong> Homepage looks / \ & lt. * \ & Gt; / searches for this text and finds it. - If there is an html source of
.description & lt; Strong & gt; Website , user sees homepage . Capacara This text is for / \ & lt ;. * \ & Gt; / and can not find it. If you want to inspect the source HTML of an element, you can:
source_text = page.evaluate_script ("document.query selector ('. Description '). InnerHTML ") source_text.should_not = ~ /\<.**>/
Comments
Post a Comment