Module: TerminusSpec::Platforms::WatirWebDriver::WebObject

Defined in:
lib/terminus_spec/platform_watir/web_objects/all.rb

Instance Method Summary collapse

Instance Method Details

#==(other) ⇒ Object



6
7
8
# File 'lib/terminus_spec/platform_watir/web_objects/all.rb', line 6

def ==(other)
  @web_object == other # other.element??
end

#attribute(attribute_name) ⇒ String?

Get the value of a the given attribute of the object.

Parameters:

  • attribute (String)

    name

Returns:

  • (String, nil)

    attribute value



81
82
83
# File 'lib/terminus_spec/platform_watir/web_objects/all.rb', line 81

def attribute(attribute_name)
  @web_object.attribute_value attribute_name
end

#clearObject



30
31
32
# File 'lib/terminus_spec/platform_watir/web_objects/all.rb', line 30

def clear
  @web_object.clear
end

#exists?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/terminus_spec/platform_watir/web_objects/all.rb', line 14

def exists?
  @web_object.exists?
end

#send_keys(*args) ⇒ Object

Send keystrokes to the object.

Parameters:

  • (String, Symbol, Array)

See Also:

  • Selenium::WebDriver::Keys::KEYS


41
42
43
# File 'lib/terminus_spec/platform_watir/web_objects/all.rb', line 41

def send_keys(*args)
  @web_object.send_keys(*args)
end

#tag_nameObject



26
27
28
# File 'lib/terminus_spec/platform_watir/web_objects/all.rb', line 26

def tag_name
  @web_object.tag_name
end

#textObject



18
19
20
# File 'lib/terminus_spec/platform_watir/web_objects/all.rb', line 18

def text
  @web_object.text
end

#valueObject



22
23
24
# File 'lib/terminus_spec/platform_watir/web_objects/all.rb', line 22

def value
  @web_object.value
end

#visible?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/terminus_spec/platform_watir/web_objects/all.rb', line 10

def visible?
  @web_object.present?
end

#wait_until(timeout = 5, message = nil, &block) ⇒ Object

Waits until a given returns true (and thus was executed).

Parameters:

  • (defaults (Integer)

    to: 5) seconds to wait before timing out

  • the (String)

    message to display if the event times out

  • the

    block to execute when the event occurs



74
75
76
# File 'lib/terminus_spec/platform_watir/web_objects/all.rb', line 74

def wait_until(timeout=5, message=nil, &block)
  Object::Watir::Wait.until(timeout, message, &block)
end

#when_not_visible(timeout = 5) ⇒ Object

Waits until an object is not visible on the screen.

Parameters:

  • (defaults (Integer)

    to: 5) seconds to wait before timing out



63
64
65
66
67
68
# File 'lib/terminus_spec/platform_watir/web_objects/all.rb', line 63

def when_not_visible(timeout=5)
  Object::Watir::Wait.while(timeout, "Object still visible after #{timeout} seconds") do
    visible?
  end
  self
end

#when_present(timeout = 5) ⇒ Object

Waits until an object is present on the screen.

Parameters:

  • (defaults (Integer)

    to: 5) seconds to wait before timing out



47
48
49
50
# File 'lib/terminus_spec/platform_watir/web_objects/all.rb', line 47

def when_present(timeout=5)
  @web_object.wait_until_present(timeout)
  self
end

#when_visible(timeout = 5) ⇒ Object

Waits until an object is visible on the screen.

Parameters:

  • (defaults (Integer)

    to: 5) seconds to wait before timing out



54
55
56
57
58
59
# File 'lib/terminus_spec/platform_watir/web_objects/all.rb', line 54

def when_visible(timeout=5)
  Object::Watir::Wait.until(timeout, "Object was not visible in #{timeout} seconds") do
    visible?
  end
  self
end