Method: Selenium::WebDriver::Driver#wait_for_text
- Defined in:
- lib/oats/oats_selenium_api.rb
#wait_for_text(value, locators, options = nil) ⇒ Object
Waits using Oats.wait_until the value matches any of the locators If succeeds returns locator, else registers Oats.error and returns false options
:is_anywhere => true Will return true if text appears anywhere on the page
412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 |
# File 'lib/oats/oats_selenium_api.rb', line 412 def wait_for_text(value, locators, = nil) ||= {} skip_error = .delete(:skip_error) if .key?(:skip_error) is_anywhere = .delete(:is_anywhere) if .key?(:is_anywhere) is_anywhere = false if webdriver? oats_debug "wait_for_text #{value.inspect}" loc = wait_for_element(locators, ) do |l| is_anywhere ? text?(value) : text?(value, l) end if loc text?(value, loc) elsif skip_error == 'fail' if loc == element?(locators) actual = text(loc) Oats.error "Expected #{value}, but received #{actual}" unless actual =~ /#{value}/ else Oats.error "Missing text #{value}" end end end |