[Webtest] verifyXPath problem

Marc Guillemot webtest@lists.canoo.com
Thu, 15 Jun 2006 00:21:24 -0700 (PDT)

Hi Dale,

first of all, your xpath expression is awfull: in most of the cases you
shouldn't use absolute xpath as it doesn't exactly express what you want to
test and would fail in cases of unrelated changes in the page. This makes
the maintenance of the test quite expensive. You should try to pick some
attribute (id, style, class of the td you want to test of of some node in
its neighborhood.

Some points have to be considered when working with xpath
- if the page is malformed, htmlunit's parser fixes it and, as a result, the
structure on which the xpath is evaluated differs from the original source
code (example: form nested between table and tr)
- the parser automatically adds a tbody between table and tr: this is
missing at one position in your xpath
- entities are evaluated, meaning that   will be replaced by the
character with code 160: your text value will not match
- text() and string() convert non breaking spaces to normal spaces and
remove duplicate spaces. This may sometimes be considered as a bug, but most
of the time rather than as a feature.



View this message in context: http://www.nabble.com/verifyXPath-problem-t1789934.html#a4878383
Sent from the WebTest forum at Nabble.com.