Zeljko has a blog entry for extending support to other elements as well. We don't currently support <b>, we do support <em>, <p> and some other "lesser?" tags. Z just answered a question on this yesterday or the day before with a link to his blog post, take a look through the group.
Otherwise the basic idea is create watir_ext.rb or whatever you want to name it file. module Watir class B < NonControlElement TAG = 'B' end end require that your file before accessing the b element and all should be good: browser.link(:after?, browser.b(:text, 'Click me')).click NB: The syntax looks right, but no guarantees if you copy/paste that it's dead on. :) Charley Baker blog: http://blog.charleybaker.org/ Lead Developer, Watir, http://wtr.rubyforge.org QA Architect, Gap Inc Direct On Wed, Jun 3, 2009 at 10:41 AM, Darin Duphorn <dduph...@redbrickhealth.com>wrote: > > Navigate to this thread, if you have any question feel free to keep asking. > > > http://groups.google.com/group/watir-general/browse_thread/thread/1e49390656d50cce/6fa3f8043da3cbe9?hl=en&lnk=gst&q=dd+tag#6fa3f8043da3cbe9 > > > > -----Original Message----- > From: watir-general@googlegroups.com [mailto: > watir-gene...@googlegroups.com] On Behalf Of James > Sent: Wednesday, June 03, 2009 11:39 AM > To: Watir General > Subject: [wtr-general] Re: Finding a specific instance of a repeated link > via text surrounding it. > > > Thanks Darin - that's really helpful! Now I just need to know how to > latch onto the text surrounded by the <b></b>. Any ideas? If that > works, then I can definitely use the "after?" method to grab the link > after it. > > (I'm still looking at xpath, but I've never used xpath before and am > finding it quite confusing!) > > Thanks, > James > > > On Jun 3, 12:27 pm, "Darin Duphorn" <dduph...@redbrickhealth.com> > wrote: > > Below is code that gets the div that appears after a label, this might > also help. > > > > label_id = $ie.div(:after?, $ie.label(:text,'Home')).span(:index,1) > > > > -----Original Message----- > > From: watir-general@googlegroups.com [mailto: > watir-gene...@googlegroups.com] On Behalf Of James > > Sent: Wednesday, June 03, 2009 11:24 AM > > To: Watir General > > Subject: [wtr-general] Re: Finding a specific instance of a repeated link > via text surrounding it. > > > > It's more like I just want to grab an element based on where it is in > > reference to another element, or in reference to text on the page. > > > > I noticed Charley's mention of xpath and am looking into it right now > > - I think it might be what I'm looking for, unless someone has another > > suggestion. > > > > James > > > > On Jun 3, 12:21 pm, "Darin Duphorn" <dduph...@redbrickhealth.com> > > wrote: > > > Ok, you want to us the information in the <B> tag to determine what > link to click. > > > > > But the <B> isn't a supported tag, so you don't know how to use it. > > > > > Is this a correct? > > > > > -----Original Message----- > > > From: watir-general@googlegroups.com [mailto: > watir-gene...@googlegroups.com] On Behalf Of James > > > Sent: Wednesday, June 03, 2009 11:17 AM > > > To: Watir General > > > Subject: [wtr-general] Re: Finding a specific instance of a repeated > link via text surrounding it. > > > > > But the text I'm referring to isn't part of the link itself. The link > > > text is the same. I'm looking at the text that occurs -before- (or > > > possibly after) the link. > > > > > Thanks for your suggestions, but unfortunately, in this example, it > > > won't work. > > > > > James > > > > > On Jun 3, 12:13 pm, Charley Baker <charley.ba...@gmail.com> wrote: > > > > Could also use multiple attributes: > > > > > > browser.link(:index => 1, :text => /Click This Link/).click > > > > > > or xpath. > > > > > > Charley Baker > > > > blog:http://blog.charleybaker.org/ > > > > Lead Developer, Watir,http://wtr.rubyforge.org > > > > QA Architect, Gap Inc Direct > > > > > > On Wed, Jun 3, 2009 at 10:10 AM, Darin Duphorn > > > > <dduph...@redbrickhealth.com>wrote: > > > > > > > Browser.link(:text,/Click This Link/).click > > > > > > > -----Original Message----- > > > > > From: watir-general@googlegroups.com > > > > > [mailto:watir-gene...@googlegroups.com] On Behalf Of James > > > > > Sent: Wednesday, June 03, 2009 11:08 AM > > > > > To: Watir General > > > > > Subject: [wtr-general] Finding a specific instance of a repeated > link > > > > > via text surrounding it. > > > > > > > I'm trying to figure out how to click on a link, and the only way I > > > > > know which link to click on is from text that comes before it. > > > > > Otherwise, it looks the same as other links on the same page. > > > > > > > So for instance, the html might look like: > > > > > > > <b>Click This Link</b> > > > > > <br> > > > > > <a href="http://clickhere.com">The Link</a> > > > > > <br> > > > > > <b>But Not this link</b> > > > > > <br> > > > > > <a href="http://clickhere.com">The Link</a> > > > > > > > I want to be able to read the page and latch onto the link with the > > > > > "Click This Link" but not other ones. In fact, if there are > multiple > > > > > "Click This Link" links, I want to be able to find all of them, and > > > > > ignore the rest. > > > > > > > I'm at a loss how to do this with Watir. I'm used to being able to > > > > > find things by div and id tags, etc., but this is a dumbed down > page > > > > > meant for mobile devices and it lacks almost all of the things I'm > > > > > used to latching onto. > > > > > > > Any suggestions? > > > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---