Sha256: 7e54da7bc06f382a4f54a08aa383f6634506da51beba6a6ca10ce6e82ebc053d

Contents?: true

Size: 670 Bytes

Versions: 3

Compression:

Stored size: 670 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 [Integer] width
    #

    def width
      wait_for_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

3 entries across 3 versions & 1 rubygems

Version Path
watir-6.2.1 lib/watir/elements/image.rb
watir-6.2.0 lib/watir/elements/image.rb
watir-6.1.0 lib/watir/elements/image.rb