WATIR - Clicking img

This is driving me up the wall.

I need to click on an apply button, however the Javascript has a number
of hidden buttons. You would think the developer would identify each one
uniquely but he hasn't. Each one is:

<input type="image" name="apply"
onClick="document.NewforOutputForm.mode.value='New';"
src="../images/apply_btn_1.gif"
OnMouseOver="this.src='../images/apply_btn_2.gif'"
OnMouseOut="this.src='../images/apply_btn_1.gif'" />

the only difference is the onClick bit.

Any ideas as to how I can click this damn button?

I've tried numerous things so any help would be appreciated.

Thanks
Tracy

···

--
Posted via http://www.ruby-forum.com/.

I'm not sure if this a great way of doing it, but I overrode the link method
to add the :html search type:

class IE
def getLink( how, what )
    [... normal code ...]
      when :html
          links.each do |thisLink|
              if what.matches(thisLink.outerHtml)
                  link = thisLink if link == nil
              end
          end
     [... rest of method ...]
This searches based on outer html. This could be used to find your link
based on contents in the onClick:

@ie.link(:html, /value='New'/).flash

/Shawn

···

On 9/12/07, Tracy Pyne <tracy.pyne@softel.co.uk> wrote:

This is driving me up the wall.

I need to click on an apply button, however the Javascript has a number
of hidden buttons. You would think the developer would identify each one
uniquely but he hasn't. Each one is:

<input type="image" name="apply"
onClick="document.NewforOutputForm.mode.value='New';"
src="../images/apply_btn_1.gif"
OnMouseOver="this.src='../images/apply_btn_2.gif'"
OnMouseOut="this.src='../images/apply_btn_1.gif'" />

the only difference is the onClick bit.

Any ideas as to how I can click this damn button?

I've tried numerous things so any help would be appreciated.

Thanks
Tracy
--
Posted via http://www.ruby-forum.com/\.