Sha256: 51e8d49b00158faa31174305ce16273acf5973dba7b273cfc2364f12094e187a

Contents?: true

Size: 667 Bytes

Versions: 1

Compression:

Stored size: 667 Bytes

Contents

module Watir
  class Image < HTMLElement

    #
    # Returns true if image is loaded.
    #
    # @return [Boolean]
    #

    def loaded?
      return false unless complete?

      driver.execute_script(
        'return typeof arguments[0].naturalWidth != "undefined" && arguments[0].naturalWidth > 0',
        @element
      )
    end

    #
    # Returns the image's width in pixels.
    #
    # @return [Fixnum] width
    #

    def width
      assert_exists
      driver.execute_script "return arguments[0].width", @element
    end

  end # Image

  module Container
     alias_method :image, :img
     alias_method :images, :imgs
  end # Container
end # Watir

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
watir-6.0.0.beta5 lib/watir/elements/image.rb