Not sure what you're trying to accomplish but there may be a simpler way: 
you can use the index-Of function in XPath. Here's the spec 
http://www.w3.org/TR/xpath-functions/#sequence-functions

echo 'String value::::'+'${linkHref}' - thought you needed double quotes 
to execute property replacement inside of GStrings





"paresh  gadre" <[email protected]> 
Sent by: [email protected]
12/18/2008 06:24 AM
Please respond to
[email protected]


To
[email protected]
cc

Subject
[Webtest] How to assign webtest property value to a groovy variable






 
 
My Code Snippet:

storeXPath property: "linkHref", propertyType: "ant", xpath: "//a...@name = 
'viewLive']/@href", default: "EMPTY"
invoke '${linkHref}'
def str = '${linkHref}'
echo 'String value::::'+'${linkHref}'
echo 'variable value::::'+str
echo ‘-----’+str.indexOf(‘?’)


I am getting following Output:
    [java]      [echo] String value::::
http://nitra.test-dealer.com.websites.dev-gparesh.blr.main.cobaltgroup.com/selenium/?reload=true

    [java]      [echo] variable value::::
http://nitra.test-dealer.com.websites.dev-gparesh.blr.main.cobaltgroup.com/selenium/?reload=true

    [java]      [echo] ----- -1 


I  want the index of  “?” character from the url  i.e 
http://nitra.test-dealer.com.websites.dev-gparesh.blr.main.cobaltgroup.com/selenium/?reload=true
.
To get the index, I m using  indexOf(‘?’) to get the index of “?”. But its 
always giving  -1.

Is the way of assigning of webtest property "${linkHref"} to groovy 
variable "str" is correct? 

Need help to re-solve this issue.

Thanks in Advance.



Reply via email to