[Webtest] namespaces and verifyxpath

Marc Guillemot webtest@lists.canoo.com
Thu, 29 Jul 2004 10:29:27 +0200

Googling on similar problem using dom4j, I've found that you can use:


quite complicated but it works.


Luca Scheuring wrote:
> good morning!
> I use verifyxpath and storexpath in different tests. with some webpages,
> these steps simply don't work (e.g. I get "no match for xpath expression
> /html/head/title; see example below). it took me some time to find out the
> problem: when a webpage specifies a namespace, xpath evaluation fails. some
> of the webpages I have to check are written in the XHTML standard. such
> pages need to have the namespace set in the root (--> <html>) element. 
> (see http://www.w3.org/TR/1999/PR-xhtml1-19991210/#docconf)
> example:
> <html xmlns="http://www.w3.org/1999/xhtml">
> <head><title>my title</title></head>
> <body>...</body>
> </html>
> for the xpath expression "/html/head/title" I don't get a match. when I
> remove the namespace, it works of couse.
> any ideas for a workaround except changing the html sources?
> thanks, 
> --luca 
> _______________________________________________
> WebTest mailing list
> WebTest@lists.canoo.com
> http://lists.canoo.com/mailman/listinfo/webtest