Hi Koorosh,

the compare function belongs to XPath 2 and is not yet supported. Nevertheless it is possible to define custom functions and to use them in xpath expressions. This can be done for instance in a (Groovy) script step. Have a look at the unit test com.canoo.webtest.steps.verify.VerifyXPathTest#testContext to see an example in java you can inspire from.

When I've prepared the structure to allow registration of custom functions, my idea was to provide additional functions (with namespace wt), among other some from XPath 2... but I haven't needed them until now and therefore didn't made any progress in this work.

Marc.

Koorosh Vakhshoori wrote:
Hi Frank,
  I am confused, how can I use verifyProperty to see if one string
lexicographically less or equal to another string. All I can do with
verifyXPath is to use regular expression to do some sort of fuzzy match.
Could you elaborate?

Thanks,
Koorosh
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Langanke, Frank
Sent: Tuesday, August 15, 2006 11:10 PM
To: [EMAIL PROTECTED]
Subject: RE: [Webtest] How to compare two strings using XPATH?

Hi,

As a quick work around you just could replace your verifyXpath task with
verifyProperty

 <verifyXPath description="Compare previous against current product"
  xpath="compare(#{previousProduct},#{currentProduct}) &lt; 1"
 />
<verifyProperty description="Compare preProd to currentProd"
      name="currentProduct"
      text="#previousProduct"/>


Cheers,

Frank.
_______________________________________________
WebTest mailing list
[email protected]
http://lists.canoo.com/mailman/listinfo/webtest
_______________________________________________
WebTest mailing list
[email protected]
http://lists.canoo.com/mailman/listinfo/webtest



_______________________________________________
WebTest mailing list
[email protected]
http://lists.canoo.com/mailman/listinfo/webtest

Reply via email to