On Oct 11, 6:52 pm, Joe Fleck <[email protected]> wrote: > Hi, > > I got the example Rahul suggested to work. I was using the text of the link > not one of the value within the href. > Is there a way to use the text? > > Thank you, > Joe
yes browser.link(:text, "textofmylink").click Another option for this kind of thing is to locate some outer container that has a name or ID. For example lets say you have a page that has both a header and a footer (with each one in a div) and there are 'about our company' links in both places, and you want to make sure you are clicking a specific one. Then you can do something along these lines browser.div(:id, 'footer').link(:text, 'about our company').click Or say you have a table, and there are a bunch of 'buy' links in one column, and book names in another column.. In that case you can be a little devious and locate the cell with the bookname you want, then in the parent of that cell (a table-row) you can click on the link that says buy.. it ends up looking something like this browser.cell(:text, 'Everyday Scripting with Ruby').parent.link(:text, 'Buy').click -- 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]
