class FireWatir::Image

Description:

Class for Image element.

Constants

TAG

Attributes

element_name[RW]

Public Class Methods

new(container, how, what) click to toggle source

Description:

Initializes the instance of image object.

Input:

- how - Attribute to identify the image element.
- what - Value of that attribute.
# File lib/firewatir/elements/image.rb, line 17
def initialize(container, how, what)
  @how = how
  @what = what
  @container = container
end

Public Instance Methods

height() click to toggle source

Description:

Gets the height of the image in pixels, as a string.

Output:

Height of image (in pixels).
# File lib/firewatir/elements/image.rb, line 93
def height
  assert_exists
  return @o.invoke("height").to_s
end
locate() click to toggle source

Description:

Locate the image element on the page.
# File lib/firewatir/elements/image.rb, line 26
def locate
  case @how
  when:jssh_name
    @element_name = @what
  when :xpath
    @element_name = element_by_xpath(@container, @what)
  else
    @element_name = locate_tagged_element('IMG', @how, @what)
  end
  @o = self
end
to_s() click to toggle source

returns a string representation of the object

# File lib/firewatir/elements/image.rb, line 55
def to_s
  assert_exists
  super({"src" => "src","width" => "width","height" => "height","alt" => "alt"})
end
width() click to toggle source

Description:

Gets the width of the image in pixels, as a string.

Output:

Width of image (in pixels).
# File lib/firewatir/elements/image.rb, line 81
def width
  assert_exists
  return @o.invoke("width").to_s
end