I think the source would help everyone give you some solid solutions.

I would think you might be able to do something like this:

ie.link(:text=>'Location 1').link(:text=>'Building Address')

Its possible but without the full source (like Derek said) its difficult to
come to a good solution.

Joe

On Thu, Oct 23, 2014 at 9:30 AM, Derek W <[email protected]> wrote:

> I don't know how people feel about xPath but this is usually where I use
> xPath.  Using hard coded index is a bit inflexible in my opinion and
> doens't tell you what it's really selecting.  What if another item with
> duplicate name appears and now you are selecting index 1, but with the
> extra duplicate item, you really want to select index 2.  I'm sure there is
> something else on the page that is unique to each of those.  If that is the
> case, you can locate that unique element first, then traverse to the text
> 'Building Address' to make sure you select the right item.
>
> If you show me the source, I can build the xPath to demonstrate what I am
> trying to explain. :)
>
> On Thu, Oct 23, 2014 at 5:06 AM, Joe Fleck <[email protected]> wrote:
>
>> +1
>> Super Kevy
>>
>> On Thu, Oct 16, 2014 at 3:47 PM, Super Kevy <
>> [email protected]> wrote:
>>
>>> ie.link(:text=>'Building Address',:index=>1).click
>>> ie.link(:text=>'Building Address',:index=>2).click
>>>
>>>
>>> On Saturday, August 2, 2014 4:36:48 AM UTC-5, Rams wrote:
>>>>
>>>>
>>>> Hi,
>>>>
>>>> I have duplicate links in the webpage as I attached (ex. Building
>>>> Address). When I looked at the html source/through developer tool bar, I
>>>> found the below attributes for each "Building Address" link.
>>>>
>>>> Please suggest, how to click on the Building Address under Location 1
>>>> and Building Address under Location 2 with the below attributes. How to
>>>> write in the ruby page file ?
>>>>
>>>> Please find the attachment for reference(duplicate_links.jpg)
>>>>
>>>> *Below is the html source for Building Address link under Location 1:*
>>>> AnchorIndex: 4
>>>> title: Enter Building Address
>>>> text: Building Address
>>>> id: anchoridpyWorkPage.ProductData.Component(Location).OptionData(1).
>>>> Component(BuildingInfo).OptionData(1).Component(
>>>> BuildingAddress).OptionData(1)
>>>> onclick:
>>>> displayDetail("pyWorkPage.ProductData.Component(
>>>> Location).OptionData(1).Component(BuildingInfo).
>>>> OptionData(1).Component(BuildingAddress).OptionData(1)
>>>> ","LocationDetails","RIGHTPANEL","pyWorkPage.ProductData.Component(
>>>> Location).OptionData(2)")
>>>>
>>>>
>>>> *Below is the html source for Building Address link under Location 2:*
>>>> AnchorIndex: 12
>>>> title: Enter Building Address
>>>> text: Building Address
>>>> id:
>>>> anchoridpyWorkPage.ProductData.Component(Location).OptionData(2).
>>>> Component(BuildingInfo).OptionData(1).Component(
>>>> BuildingAddress).OptionData(1)
>>>> onclick:
>>>> displayDetail("pyWorkPage.ProductData.Component(
>>>> Location).OptionData(2).Component(BuildingInfo).
>>>> OptionData(1).Component(BuildingAddress).OptionData(1)
>>>> ","LocationDetails","RIGHTPANEL","pyWorkPage.ProductData.Component(
>>>> Location).OptionData(2)")
>>>>
>>>>
>>>> Thanks
>>>>
>>>  --
>>> --
>>> Before posting, please read http://watir.com/support. In short: search
>>> before you ask, be nice.
>>>
>>> [email protected]
>>> http://groups.google.com/group/watir-general
>>> [email protected]
>>>
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "Watir General" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>  --
>> --
>> Before posting, please read http://watir.com/support. In short: search
>> before you ask, be nice.
>>
>> [email protected]
>> http://groups.google.com/group/watir-general
>> [email protected]
>>
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "Watir General" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> --
> Derek Wrobel
> 425-243-3355
>
> --
> --
> Before posting, please read http://watir.com/support. In short: search
> before you ask, be nice.
>
> [email protected]
> http://groups.google.com/group/watir-general
> [email protected]
>
> ---
> You received this message because you are subscribed to the Google Groups
> "Watir General" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

[email protected]
http://groups.google.com/group/watir-general
[email protected]

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to