Sha256: 99c8fe87db9d3f9adc73089d22ff2f23d0cabcfb81bd104ba93dd92e4a928e19

Contents?: true

Size: 854 Bytes

Versions: 23

Compression:

Stored size: 854 Bytes

Contents

module Webdrone
  class Browser
    def wait
      @wait ||= Wait.new self
    end
  end

  class Wait
    attr_accessor :a0, :ignore

    def initialize(a0)
      @a0 = a0
      @ignore = []
      @ignore << Selenium::WebDriver::Error::StaleElementReferenceError
      @ignore << Selenium::WebDriver::Error::NoSuchElementError
      @ignore << Selenium::WebDriver::Error::NoSuchFrameError
      @ignore << Selenium::WebDriver::Error::InvalidSelectorError
    end

    def for
      if @a0.conf.timeout
        Selenium::WebDriver::Wait.new(timeout: @a0.conf.timeout, ignore: @ignore).until do
          yield
        end
      else
        yield
      end
    rescue => exception
      Webdrone.report_error(@a0, exception)
    end

    def time(val)
      sleep val
    rescue => exception
      Webdrone.report_error(@a0, exception)
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
webdrone-1.7.8 lib/webdrone/wait.rb
webdrone-1.7.4 lib/webdrone/wait.rb
webdrone-1.7.2 lib/webdrone/wait.rb
webdrone-1.7.0 lib/webdrone/wait.rb
webdrone-1.6.2 lib/webdrone/wait.rb
webdrone-1.6.0 lib/webdrone/wait.rb
webdrone-1.5.0 lib/webdrone/wait.rb
webdrone-1.4.8 lib/webdrone/wait.rb
webdrone-1.4.6 lib/webdrone/wait.rb
webdrone-1.4.4 lib/webdrone/wait.rb
webdrone-1.4.2 lib/webdrone/wait.rb
webdrone-1.4.0 lib/webdrone/wait.rb
webdrone-1.3.6 lib/webdrone/wait.rb
webdrone-1.3.4 lib/webdrone/wait.rb
webdrone-1.3.2 lib/webdrone/wait.rb
webdrone-1.3.0 lib/webdrone/wait.rb
webdrone-1.2.2 lib/webdrone/wait.rb
webdrone-1.2.0 lib/webdrone/wait.rb
webdrone-1.1.4 lib/webdrone/wait.rb
webdrone-1.1.2 lib/webdrone/wait.rb