featurist / browser-monkey

Reliable DOM testing
https://browsermonkey.org
53 stars 6 forks source link

Text is considered as it appears in the HTML source, rather than as displayed #3

Closed adiel closed 9 years ago

adiel commented 9 years ago
<p>
    That's
    not
    right
</p>

is expected to be "That's\n not\n right\n" when finding by / asserting on text

refractalize commented 9 years ago

so should normalise all white space in text to one space? text.trim().replace(/\s+/g, ' ')

adiel commented 9 years ago

It's as much about line breaks as whitespace. innerText gives you line breaks in the right place, then we normalise spaces incl at the beginning and end of a line.

This is what Selenium does internally somewhere