[Webtest] Re: XPath implementation in WebTest
Dierk König
Dierk König
Fri, 16 May 2008 18:37:51 +0200 (CEST)
how about
//abc[max(1,last()-1)]
?
BTW: abc[x] is short for abc[position()=x], which means it is _not_ the
xth abc in the document but an abc that is the xth child of whatever
parent.
cheers
Dierk
| -----Original Message-----
| From: webtest-admin@lists.canoo.com
| [mailto:webtest-admin@lists.canoo.com] On Behalf Of George Policello
| Sent: Freitag, 16. Mai 2008 17:54
| To: webtest@lists.canoo.com; Harihara Vinayakaram
| Subject: RE: [Webtest] Re: XPath implementation in WebTest
|
| I do not have an XPath manual in front of me at the moment
| but wonder if this would work.
|
|
|
| //abc[last()-1] | //abc[last()]
|
|
|
| It would in some scripting languages and some compiled languages.
|
|
|
| Also, a conditional could probably work using the “nilled(
//abc[last() -1] )” function in XPath.
|
|
|
| George
|
| ________________________________
|
| From: webtest-admin@lists.canoo.com
| [mailto:webtest-admin@lists.canoo.com] On Behalf Of Harihara
| Vinayakaram
| Sent: Friday, May 16, 2008 8:40 AM
| To: webtest@lists.canoo.com
| Subject: [Webtest] Re: XPath implementation in WebTest
|
|
|
| I am sorry but the xpath expression works the same way in
| Saxon as it does in webtest .
| So maybe I am looking for an xpath expression that gets the
| only node even if the expression is last() -1
|
| Regards
| Hari
|
|
|
| On Fri, May 16, 2008 at 8:49 PM, Harihara Vinayakaram
| <hvram1@gmail.com> wrote:
|
| Hi
| I am not sure if this is the right place to ask this
| question . But anyway
|
| My understanding is that the xpath exression //abc[last()-1]
| will return the last but one element named abc .
|
| It works most of the times except when there is only one element .
|
| In that case WebTest returns element not found while others
| like saxon for example returns the last element .
|
| Is this a bug ? or is my understanding wrong
|
| Regards
| Hari
|
|
|
|