[Webtest] Re: problems with verifyxpath

Christopher Painter-Wakefield webtest@lists.canoo.com
Mon, 26 Apr 2004 09:57:24 -0400

Your verifyxpath syntax looks good to me.  You should be able to use any
valid xpath expression.  You can use count() and text() because they are
XPath functions, not XSL functions.  There were some issues in the past
with selecting an object that wasn't a node, but I think these may have
been resolved (I am still using an older, patched version, so I don't know
what the latest code does.) You probably can't use XSL-specific functions
like document() or format-number().

The page can be plain HTML, but it has to be passed through jTidy to get
XHTML which can be parsed for the verifyxpath and related steps.  If your
HTML is particularly badly formed, jTidy might have problems with it (and
you should see a lot of errors on your command line, I think).

If you could post your test script and a sample of your HTML, it might


From: Massimiliano Mauri <massimiliano.mauri@wise-lab.it>
To: webtest@lists.canoo.com
Subject: [Webtest] problems with verifyxpath

I'm testing a web application and I have some problems with

This steps seems not work.
For example, searching in the page a link with the step <verifyxpath
stepid="verify xpath 1" xpath="//a"/> canoo web test get a failure message

In the report Canoo WebTest returns this message
com.canoo.webtest.engine.StepFailedException: xpath test: //a matched no
Step: VerifyXPath at file:C:/.../test/build.xml:29:
with (text="null", stepId="verify xpath 1", xpath="//a", regex="false",

I'm tryng also with <verifyxpath stepid="verify xpath 1"
xpath="//a[@href='myPage.jsp']"/>, but I have the same result. (and the
link exists in the tested page)

My first question is: this step search an <a> tag in the page HTML with
label "null"? why?
reading the syntax reference if the text attribute is not specified
<verifyxpath> "...match at least one node in the document object model..."

The page HTML may be a simple HTML or have to be a XHTML?

I have another question: <verifyxpath> supports XSLfunctions like count(),

I hope somebody will be able to help me...