Module: TerminusSpec::Platforms::SeleniumWebDriver::WebObject
- Defined in:
- lib/terminus_spec/platform_selenium/web_objects/all.rb
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#attribute(attribute_name) ⇒ String?
Get the value of a the given attribute of the object.
- #clear ⇒ Object
- #exists? ⇒ Boolean
- #right_click ⇒ Object
-
#send_keys(*args) ⇒ Object
Send keystrokes to the object.
- #tag_name ⇒ Object
- #text ⇒ Object
- #value ⇒ Object
- #visible? ⇒ Boolean
-
#wait_until(timeout = 5, message = nil, &block) ⇒ Object
Waits until a given returns true (and thus was executed).
-
#when_not_visible(timeout = 5) ⇒ Object
Waits until an object is not visible on the screen.
-
#when_present(timeout = 5) ⇒ Object
Waits until an object is present on the screen.
-
#when_visible(timeout = 5) ⇒ Object
Waits until an object is visible on the screen.
Instance Method Details
#==(other) ⇒ Object
6 7 8 |
# File 'lib/terminus_spec/platform_selenium/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.
91 92 93 |
# File 'lib/terminus_spec/platform_selenium/web_objects/all.rb', line 91 def attribute(attribute_name) @web_object.attribute attribute_name end |
#clear ⇒ Object
30 31 32 |
# File 'lib/terminus_spec/platform_selenium/web_objects/all.rb', line 30 def clear @web_object.clear end |
#exists? ⇒ Boolean
14 15 16 |
# File 'lib/terminus_spec/platform_selenium/web_objects/all.rb', line 14 def exists? nil != @web_object end |
#right_click ⇒ Object
34 35 36 |
# File 'lib/terminus_spec/platform_selenium/web_objects/all.rb', line 34 def right_click @web_object.context_click end |
#send_keys(*args) ⇒ Object
Send keystrokes to the object.
45 46 47 |
# File 'lib/terminus_spec/platform_selenium/web_objects/all.rb', line 45 def send_keys(*args) @web_object.send_keys(*args) end |
#tag_name ⇒ Object
26 27 28 |
# File 'lib/terminus_spec/platform_selenium/web_objects/all.rb', line 26 def tag_name @web_object.tag_name end |
#text ⇒ Object
18 19 20 |
# File 'lib/terminus_spec/platform_selenium/web_objects/all.rb', line 18 def text @web_object.text end |
#value ⇒ Object
22 23 24 |
# File 'lib/terminus_spec/platform_selenium/web_objects/all.rb', line 22 def value @web_object.attribute('value') end |
#visible? ⇒ Boolean
10 11 12 |
# File 'lib/terminus_spec/platform_selenium/web_objects/all.rb', line 10 def visible? @web_object.displayed? end |
#wait_until(timeout = 5, message = nil, &block) ⇒ Object
Waits until a given returns true (and thus was executed).
83 84 85 86 |
# File 'lib/terminus_spec/platform_selenium/web_objects/all.rb', line 83 def wait_until(timeout=5, =nil, &block) wait = Object::Selenium::WebDriver::Wait.new({:timeout => timeout, :message => }) wait.until(&block) end |
#when_not_visible(timeout = 5) ⇒ Object
Waits until an object is not visible on the screen.
71 72 73 74 75 76 77 |
# File 'lib/terminus_spec/platform_selenium/web_objects/all.rb', line 71 def when_not_visible(timeout=5) wait = Object::Selenium::WebDriver::Wait.new({:timeout => timeout, :message => "Object not present in #{timeout} seconds"}) wait.until do not self.visible? end self end |
#when_present(timeout = 5) ⇒ Object
Waits until an object is present on the screen.
51 52 53 54 55 56 57 |
# File 'lib/terminus_spec/platform_selenium/web_objects/all.rb', line 51 def when_present(timeout=5) wait = Object::Selenium::WebDriver::Wait.new({:timeout => timeout, :message => "Object not present in #{timeout} seconds"}) wait.until do self.exists? end self end |
#when_visible(timeout = 5) ⇒ Object
Waits until an object is visible on the screen.
61 62 63 64 65 66 67 |
# File 'lib/terminus_spec/platform_selenium/web_objects/all.rb', line 61 def when_visible(timeout=5) wait = Object::Selenium::WebDriver::Wait.new({:timeout => timeout, :message => "Object not present in #{timeout} seconds"}) wait.until do self.visible? end self end |