I am trying to click on the image:

image             name=               id=                 value=             
  al
t=                src=http://172.16.54.111/images/buttons/ok.gif

Using irb...

irb(main):007:0> browser.image(:src, 
'http://172.16.54.111/images/buttons/ok.gif
').click
Watir::Exception::UnknownObjectException: Unable to locate object, using src 
and
http://172.16.54.111/images/buttons/ok.gif
        from 
c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1054/./watir.rb:2267:in
`assert_exists'
        from 
c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1054/./watir.rb:2405:in
`click'
        from (irb):7

I also tried a regex ( /ok.gif/ ), and a different method (flash) just to 
see if the object would be found, but no luck.

Thanks for your help.


Andrew McFarlane





>From: "Chris McMahon" <[EMAIL PROTECTED]>
>Reply-To: [email protected]
>To: [email protected]
>Subject: Re: [Wtr-general] <input type="image" name="xxx"> How to use it 
>inWatir?
>Date: Wed, 2 Aug 2006 14:24:14 -0700
>
>On 8/2/06, Andrew McFarlane <[EMAIL PROTECTED]> wrote:
> > So, if I have an image button that does not have a name, id, or alt
> > attribute value, but does have a src attribute value, I cannot click it?
>
>While the comments in watir.rb are not 100% accurate, they will answer
>a great many questions:
>
>        # This is the main method for accessing images - normally an
><img src="image.gif"> HTML tag.
>         #  *  how   - symbol - how we access the image, :index, :id,
>:name, :src, :title or :alt are supported
>         #  *  what  - string or regexp - what we are looking for
>         #
>         # returns an Image object
>         #
>         # Valid values for 'how' are
>         #
>         #    :index      - find the item using the index in the
>container (a container can be a document, a TableCell, a Span, a Div
>or a P
>         #                  index is 1 based
>         #    :name       - find the item using the name attribute
>         #    :id         - find the item using the id attribute
>         #    :alt        - finds the item using the alt text (tool tip)
>         #    :src        - finds the item using the src tag. This must
>be the fully qualified name, so is best used with a regular expression
>         #    :xpath      - finds the item that matches xpath query
>         #    :title      - finds the item using the title (tool tip)
>         #
>         # Typical Usage
>         #
>         #   ie.image(:src, /myPic/)             # access the first
>image that matches myPic. We can use a string in place of the regular
>expression
>         #                                       # but the complete
>path must be used, ie.image(:src,
>'http://myserver.com/my_path/my_image.jpg')
>         #   ie.image(:index,2)                  # access the second
>image on the page
>         #   ie.image(:alt, "A Picture")        # access an image using
>the alt text
>         #   ie.image(:xpath, "//[EMAIL PROTECTED]'A Picture']/")    # access
>an image using the alt text
>         #
>_______________________________________________
>Wtr-general mailing list
>[email protected]
>http://rubyforge.org/mailman/listinfo/wtr-general


_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general

Reply via email to