I popped the OP's code into a simple html page and Željko's approach worked great. If the content in the third element might change (and not literally say something as friendly as "Three"), here's a more robust approach:
MyCells = Array.new browser.cells.each do |cell| # If looking for a specific table, browser.table(:class, /testing/).cells.each do |cell| if cell.id == "zippy" # Assuming you only want the cells with this id MyCells << [cell.id, cell.text] else end #if end #cells.each MyCells.last # Grab the last element MyCells[2] # Grab the third element Of course, if all you need is simple functionality, go with simple code! -Adam On May 6, 10:08 am, Željko Filipin <zeljko.fili...@wa-research.ch> wrote: > On Thu, May 6, 2010 at 4:58 PM, tjp <kris...@gmail.com> wrote: > > <td id="zippy">One</td> > > <td id="zippy">Two</td> > > <td id="zippy">Three</td> > > How do I refer to the third one? > > Not tested, but should work: > > browser.cell(:text => "Three") > > or > > browser.cell(:id => "zippy", :text => "Three") > > Željko > -- > watir.com - community manager > pledgie.com/campaigns/2982 - donate to Watir > watirpodcast.com - host > testingpodcast.com - audio podcasts on software testing. all of them > > -- > Before posting, please readhttp://watir.com/support. In short: search before > you ask, be nice. > > You received this message because you are subscribed > tohttp://groups.google.com/group/watir-general > To post: watir-general@googlegroups.com > To unsubscribe: watir-general+unsubscr...@googlegroups.com -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. You received this message because you are subscribed to http://groups.google.com/group/watir-general To post: watir-general@googlegroups.com To unsubscribe: watir-general+unsubscr...@googlegroups.com