Sha256: 185feacbc12687d4385a391e693547bffeb85a8d3407a5cc585b84793d6d0417

Contents?: true

Size: 904 Bytes

Versions: 9

Compression:

Stored size: 904 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, Kernel.caller_locations)
    end

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

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
webdrone-1.0.4 lib/webdrone/wait.rb
webdrone-1.0.0 lib/webdrone/wait.rb
webdrone-0.9.9 lib/webdrone/wait.rb
webdrone-0.9.8 lib/webdrone/wait.rb
webdrone-0.9.2 lib/webdrone/wait.rb
webdrone-0.9.0 lib/webdrone/wait.rb
webdrone-0.8.4 lib/webdrone/wait.rb
webdrone-0.8.2 lib/webdrone/wait.rb
webdrone-0.8.0 lib/webdrone/wait.rb