module PageObject::Platforms::LdsWatirWebDriver::Element

Public Instance Methods

==(other) click to toggle source

compare this element to another to determine if they are equal

# File lib/page-object/platforms/lds_watir_webdriver/element.rb, line 62
def ==(other)
  element == other.element
end
attribute(attribute_name) click to toggle source

Get the value of a the given attribute of the element. Will return the current value, even if this has been modified after the page has been loaded. More exactly, this method will return the value of the given attribute, unless that attribute is not present, in which case the value of the property with the same name is returned. If neither value is set, nil is returned. The “style” attribute is converted as best can be to a text representation with a trailing semi-colon. The following are deemed to be “boolean” attributes, and will return either “true” or “false”:

async, autofocus, autoplay, checked, compact, complete, controls, declare, defaultchecked, defaultselected, defer, disabled, draggable, ended, formnovalidate, hidden, indeterminate, iscontenteditable, ismap, itemscope, loop, multiple, muted, nohref, noresize, noshade, novalidate, nowrap, open, paused, pubdate, readonly, required, reversed, scoped, seamless, seeking, selected, spellcheck, truespeed, willvalidate

Finally, the following commonly mis-capitalized attribute/property names are evaluated as expected:

class, readonly

@param [String]

attribute name

@return [String,nil]

attribute value
# File lib/page-object/platforms/lds_watir_webdriver/element.rb, line 105
def attribute(attribute_name)
  element.attribute_value attribute_name
end
clear() click to toggle source

clear the contents of the element

# File lib/page-object/platforms/lds_watir_webdriver/element.rb, line 229
def clear
  element.clear
end
double_click() click to toggle source

double click the element

# File lib/page-object/platforms/lds_watir_webdriver/element.rb, line 126
def double_click
  element.double_click
end
exists?() click to toggle source

return true if an element exists

# File lib/page-object/platforms/lds_watir_webdriver/element.rb, line 21
def exists?
  element.exists?
end
fire_event(event_name) click to toggle source

Fire the provided event on the current element

# File lib/page-object/platforms/lds_watir_webdriver/element.rb, line 112
def fire_event(event_name)
  element.fire_event(event_name)
end
flash() click to toggle source

flash the element by temporarily changing the background color

# File lib/page-object/platforms/lds_watir_webdriver/element.rb, line 28
def flash
  element.flash
end
focus() click to toggle source

Set the focus to the current element

# File lib/page-object/platforms/lds_watir_webdriver/element.rb, line 143
def focus
  element.focus
end
hover() click to toggle source

hover over the element

# File lib/page-object/platforms/lds_watir_webdriver/element.rb, line 119
def hover
  element.hover
end
html() click to toggle source

Get the html for the element

@return [String]

# File lib/page-object/platforms/lds_watir_webdriver/element.rb, line 46
def html
  element.html
end
id() click to toggle source

get the id of the element

# File lib/page-object/platforms/lds_watir_webdriver/element.rb, line 236
def id
  element.id
end
parent() click to toggle source

find the parent element

# File lib/page-object/platforms/lds_watir_webdriver/element.rb, line 133
def parent
  parent = element.parent
  type = element.type if parent.tag_name.to_sym == :input
  cls = ::PageObject::Elements.element_class_for(parent.tag_name, type)
  cls.new(parent, :platform => :lds_watir_webdriver)
end
scroll_into_view() click to toggle source

Scroll until the element is viewable

# File lib/page-object/platforms/lds_watir_webdriver/element.rb, line 243
def scroll_into_view
  element.wd.location_once_scrolled_into_view
end
select_text(text) click to toggle source

Select the provided text

# File lib/page-object/platforms/lds_watir_webdriver/element.rb, line 150
def select_text(text)
  element.select_text text
end
send_keys(*args) click to toggle source

Send keystrokes to this element

@param [String, Symbol, Array]

Examples:

element.send_keys "foo"                     #=> value: 'foo'
element.send_keys "tet", :arrow_left, "s"   #=> value: 'test'
element.send_keys [:control, 'a'], :space   #=> value: ' '

@see Selenium::WebDriver::Keys::KEYS

# File lib/page-object/platforms/lds_watir_webdriver/element.rb, line 222
def send_keys(*args)
  element.send_keys(*args)
end
tag_name() click to toggle source

Get the tag name of this element

@return [String]

# File lib/page-object/platforms/lds_watir_webdriver/element.rb, line 71
def tag_name
  element.tag_name
end
text() click to toggle source

Get the text for the element

@return [String]

# File lib/page-object/platforms/lds_watir_webdriver/element.rb, line 37
def text
  element.text
end
value() click to toggle source

Get the value of this element

@return [String]

# File lib/page-object/platforms/lds_watir_webdriver/element.rb, line 55
def value
  element.value
end
visible?() click to toggle source

return true if an element is visible

# File lib/page-object/platforms/lds_watir_webdriver/element.rb, line 14
def visible?
  element.present?
end
wait_until(timeout=::PageObject.default_element_wait, message=nil, &block) click to toggle source

Waits until the block returns true

@param [Integer] (defaults to: 5) seconds to wait before timing out @param [String] the message to display if the event timeouts @param the block to execute when the event occurs

# File lib/page-object/platforms/lds_watir_webdriver/element.rb, line 205
def wait_until(timeout=::PageObject.default_element_wait, message=nil, &block)
  Object::Watir::Wait.until(timeout, message, &block)
end
when_not_present(timeout=::PageObject.default_element_wait) click to toggle source

Waits until the element is not present

@param [Integer] (defaults to: 5) seconds to wait before timing out

# File lib/page-object/platforms/lds_watir_webdriver/element.rb, line 170
def when_not_present(timeout=::PageObject.default_element_wait)
  element.wait_while_present(timeout)
end
when_not_visible(timeout=::PageObject.default_element_wait) click to toggle source

Waits until the element is not visible

@param [Integer] (defaults to: 5) seconds to wait before timing out

# File lib/page-object/platforms/lds_watir_webdriver/element.rb, line 191
def when_not_visible(timeout=::PageObject.default_element_wait)
  Object::Watir::Wait.while(timeout, "Element still visible after #{timeout} seconds") do
    visible?
  end
  self
end
when_present(timeout=::PageObject.default_element_wait) click to toggle source

Waits until the element is present

@param [Integer] (defaults to: 5) seconds to wait before timing out

# File lib/page-object/platforms/lds_watir_webdriver/element.rb, line 159
def when_present(timeout=::PageObject.default_element_wait)
  element.wait_until_present(timeout)
  self
end
when_visible(timeout=::PageObject.default_element_wait) click to toggle source

Waits until the element is visible

@param [Integer] (defaults to: 5) seconds to wait before timing out

# File lib/page-object/platforms/lds_watir_webdriver/element.rb, line 179
def when_visible(timeout=::PageObject.default_element_wait)
  Object::Watir::Wait.until(timeout, "Element was not visible in #{timeout} seconds") do
    visible?
  end
  self
end