Method: Selenium::WebDriver::Driver#wait_until_loaded

Defined in:
lib/oats/oats_selenium_api.rb

#wait_until_loaded(options = {}) ⇒ Object



505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
# File 'lib/oats/oats_selenium_api.rb', line 505

def wait_until_loaded(options = {})
  #    puts '------------------'
  #    src = selenium.get_html_source
  #    puts src
  #    puts '------------------'
  options[:message] = "Did not finish loading"
  Oats.wait_until(options) do
    if selenium.element?("//div[@class = 'loading' and not (contains(@style, 'display: none'))]")
      oats_debug 'noticed loading...'
      true
    else
      oats_debug 'waiting to see loading...'
      false
    end
  end
  Oats.wait_until(options) do
    if selenium.element?("//div[@class = 'loading' and not (contains(@style, 'display: none'))]")
      oats_debug 'finished loading...'
      false
      oats_debug 'still loading...'
    else
      true
    end
  end
end