[Webtest] XPath: Absolut element location versus conditional branch

Dierk Koenig webtest@lists.canoo.com
Wed, 27 Nov 2002 14:46:51 +0100


Hi,

not a full help but maybe some hints about using XPath:

- whenever a match works where not expected, make it fail and watch the
error output
  to validate the string representation of the output.
  This is also a good opportunity to check for the off-by-one errors in
indexes.

- don't mix "location step" and "expression", e.g. //tr[td=XXX] will _not_
locate a td node, but
  a tr node (read "select //tr where [td=XXX]").
  An alternative would be //tr/td[string(.)=XXX]

- WebTest works on the string value
(http://www.w3.org/TR/xpath#dt-string-value) of
  the xpath selection. This may unexpectedly (or on purpose) include child
node contents.

cheers
Dierk