Click on html element

Hi, I need to click on an html element using watir and firewatir, for
example:

A Since this is not a button or a link... how can I do it?

No ideas?

On Wed, Aug 18, 2010 at 1:30 PM, Mario R. [email protected] wrote:

No ideas?

I tested with this html:

Click me !

and this code worked for me:

irb(main):006:0> ff =
FireWatir::Firefox.start(“file:///home/jesus/temp/click_div.html”)
=> #<FireWatir::Firefox:0x…fb6e55edc
url=“file:///home/jesus/temp/click_div.html” title=“”>
irb(main):008:0> ff.div(:id, “theDiv”)
=> #<FireWatir::Div:0x…fb6e471ac located=false how=:id what=“theDiv”>
irb(main):009:0> ff.div(:id, “theDiv”).exists?
=> true
irb(main):010:0> ff.div(:id, “theDiv”).click

This opened the alert in my Firefox window, so the div was clicked.

You can look at the FireWatir documentation here to see how you can
get a reference to the element you want:

http://wtr.rubyforge.org/rdoc/1.6.5/

I think there are methods to get any HTML element, such as table, cell
and so on.

Jesus.