This ought to get you the link element:

@browser.element_by_xpath("//p[contains(text(), 'by Chelsea
Groves')]/preceding-sibling::p/a")

Richard

--
Richard Lawrence
Certified Scrum Coach
Founder and Principal Consultant, Humanizing Work, LLC
303-895-7688
rich...@humanizingwork.com
www.humanizingwork.com
www.richardlawrence.info

On Tue, Dec 16, 2008 at 4:56 AM, Natasha <itsn...@yahoo.co.uk> wrote:

>
> Hello All,
>
> Please could someone help me with a way to access a link element.
>
> Following is the HTML snippet:
>
> <DIV>
> <A><IMG></IMG><A>
> <P><A> Chelsea Groves Business Cards</A> </P>
> <P class=pBy> by Chelsea Groves </P>
> <DIV>
>
> I need to click on the link with text "Chelsea Groves Business Cards".
> But following is what I actually want to do. I want to click the link
> before the P tag having text ' by Chelsea Groves', rather then simply
> clicking on link having text ' Chelsea Groves Business Cards'.
>
> Thanks,
> Natasha
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
watir-general-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~----------~----~----~----~------~----~------~--~---

Reply via email to