Module: Watir::Waitable
- Included in:
- Alert, Browser, Element, ElementCollection, Window, WindowCollection
- Defined in:
- lib/watir/wait.rb
Overview
Wait
Instance Method Summary collapse
-
#wait_until(depr_timeout = nil, depr_message = nil, timeout: nil, message: nil, interval: nil, **opt, &blk) ⇒ Object
Waits until the condition is true.
-
#wait_until_present(depr_timeout = nil, timeout: nil, interval: nil, message: nil) ⇒ Object
Waits until the element is present.
-
#wait_while(depr_timeout = nil, depr_message = nil, timeout: nil, message: nil, interval: nil, **opt, &blk) ⇒ Object
Waits while the condition is true.
-
#wait_while_present(depr_timeout = nil, timeout: nil, interval: nil, message: nil) ⇒ Object
Waits while the element is present.
Instance Method Details
#wait_until(depr_timeout = nil, depr_message = nil, timeout: nil, message: nil, interval: nil, **opt, &blk) ⇒ Object
Waits until the condition is true.
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 |
# File 'lib/watir/wait.rb', line 114 def wait_until(depr_timeout = nil, = nil, timeout: nil, message: nil, interval: nil, **opt, &blk) if || depr_timeout Watir.logger.deprecate 'Using arguments for #wait_until', 'keywords', ids: [:timeout_arguments] timeout = depr_timeout = end ||= proc { |obj| "waiting for true condition on #{obj.inspect}" } # TODO: Consider throwing argument error for mixing block & options proc = create_proc(opt, &blk) Wait.until(timeout: timeout, message: , interval: interval, object: self, &proc) self end |
#wait_until_present(depr_timeout = nil, timeout: nil, interval: nil, message: nil) ⇒ Object
Waits until the element is present. Element is always relocated, so this can be used in the case of an element going away and returning
176 177 178 179 180 181 182 183 184 |
# File 'lib/watir/wait.rb', line 176 def wait_until_present(depr_timeout = nil, timeout: nil, interval: nil, message: nil) timeout = depr_timeout if depr_timeout Watir.logger.deprecate "#{self.class}#wait_until_present", "#{self.class}#wait_until(&:present?)", ids: [:wait_until_present] ||= proc { |obj| "waiting for #{obj.inspect} to become present" } wait_until(timeout: timeout, interval: interval, message: , element_reset: true, &:present?) end |
#wait_while(depr_timeout = nil, depr_message = nil, timeout: nil, message: nil, interval: nil, **opt, &blk) ⇒ Object
TODO:
add element example
Waits while the condition is true.
145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 |
# File 'lib/watir/wait.rb', line 145 def wait_while(depr_timeout = nil, = nil, timeout: nil, message: nil, interval: nil, **opt, &blk) if || depr_timeout Watir.logger.deprecate 'Using arguments for #wait_while', 'keywords', ids: [:timeout_arguments] timeout = depr_timeout = end ||= proc { |obj| "waiting for false condition on #{obj.inspect}" } # TODO: Consider throwing argument error for mixing block & options proc = create_proc(opt, &blk) Wait.while(timeout: timeout, message: , interval: interval, object: self, &proc) self end |
#wait_while_present(depr_timeout = nil, timeout: nil, interval: nil, message: nil) ⇒ Object
Waits while the element is present. Element is always relocated, so this can be used in the case of the element changing attributes
201 202 203 204 205 206 207 208 209 |
# File 'lib/watir/wait.rb', line 201 def wait_while_present(depr_timeout = nil, timeout: nil, interval: nil, message: nil) timeout = depr_timeout if depr_timeout Watir.logger.deprecate "#{self.class}#wait_while_present", "#{self.class}#wait_while(&:present?)", ids: [:wait_while_present] ||= proc { |obj| "waiting for #{obj.inspect} not to be present" } wait_while(timeout: timeout, interval: interval, message: , element_reset: true, &:present?) end |