Here is a pair that works for me to get a link text:

    String ROW_COUNT_XPATH = "count(//t...@class='listItem'])"
    String FIRST_ITEM_XPATH = "//t...@class='listItem'][1]/a/text()"

    def verifyListPage(int count) {
        ant.group(description:"verify ContextConfig list view with $count
row(s)") {
            verifyText(text:'ContextConfig List')
            verifyXPath(xpath: ROW_COUNT_XPATH, text:count,
description:"$count row(s) of data expected")
        }
    }

    def uri

    def clickListLink(int count) {
        ant.group(description:"Click the first ContextConfig list link.") {
            storeXPath( description:"Extract FIRST_ITEM_XPATH of first link
on page",
                        xpath:
"//t...@class='listItem']["+count+"]/a/text()",
                        property: "uri")
            clickLink(label: "#{uri}")
            verifyText(text:'Show ContextConfig', description:'Detail page')
        }
    }


---
Thank You…

Mick Knutson, President

BASE Logic, Inc.
Enterprise Architecture, Design, Mentoring & Agile Consulting
p. (866) BLiNC-411: (254-6241-1)
f. (415) 685-4233

Website: http://www.baselogic.com
Linked IN: http://linkedin.com/in/mickknutson
Twitter: http://twitter.com/mickknutson
Vacation Rental: http://tahoe.baselogic.com
---



On Wed, Mar 24, 2010 at 11:40 AM, sriharini sriharini <[email protected]>wrote:

> Thanks Mick. I get the xpath now for the second item. But the storeXpath is
> failing. Do i have to do any thing special?
>
> here is the step:
> <storeXpath xpath="(//span[...@class='normalText'])[2]/text()"
> property="account id"/>
>
>
> Thanks,
> Srini
>
>
> On Tue, Mar 23, 2010 at 5:02 PM, Mick Knutson <[email protected]>wrote:
>
>> Try:
>>
>> String FIRST_ITEM_XPATH = "//sp...@class='normalText'][1]/text()"
>>
>> ---
>> Thank You…
>>
>> Mick Knutson, President
>>
>> BASE Logic, Inc.
>> Enterprise Architecture, Design, Mentoring & Agile Consulting
>> p. (866) BLiNC-411: (254-6241-1)
>> f. (415) 685-4233
>>
>> Website: http://www.baselogic.com
>> Linked IN: http://linkedin.com/in/mickknutson
>> Twitter: http://twitter.com/mickknutson
>> Vacation Rental: http://tahoe.baselogic.com
>> ---
>>
>>
>>
>>
>> On Tue, Mar 23, 2010 at 1:43 PM, sriharini sriharini 
>> <[email protected]>wrote:
>>
>>>
>>>
>>> Hi,
>>> I am trying to get the xpath  for 123456 and store it
>>> Can you please help in writing the xpath and storing the value.
>>>
>>> Below is the code
>>>
>>> Thanks for the help.
>>>
>>> Regards
>>> srini
>>>
>>> I tried this, but my test is failing for this step
>>> <storeXpath xpath="(//sp...@class='normalText'])[2]/.."
>>> property="confirm_id"/>
>>>
>>>
>>> -----------------------------------------------------------------------------------------------------------------------------
>>>                    <tr>
>>>                       <td align="right"><span
>>> class="boldText">Confirmation Number:</span></td>
>>>                       <td><span
>>> class="normalText">DE28-572145</span></td>
>>>                    </tr>
>>>                    <tr>
>>>                       <td align="right"><span
>>> class="boldText">Transaction Id#:</span></td>
>>>                       <td><span class="normalText">*123456*</span></td>
>>>                    </tr>
>>>
>>> -----------------------------------------------------------------------------------------------------------------------------------
>>>
>>
>>
>

Reply via email to