Sha256: 0799b08333f3c2d4500ed176e698f7994529b40bcc939de274d7404b92d1d0e1

Contents?: true

Size: 669 Bytes

Versions: 4

Compression:

Stored size: 669 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
      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

4 entries across 4 versions & 1 rubygems

Version Path
watir-6.0.3 lib/watir/elements/image.rb
watir-6.0.2 lib/watir/elements/image.rb
watir-6.0.1 lib/watir/elements/image.rb
watir-6.0.0 lib/watir/elements/image.rb