Sha256: 1ab7ff3b7deab5b38c685ea27d46284ebd9b6b49c015e5f7514a8d92a4f23416

Contents?: true

Size: 718 Bytes

Versions: 8

Compression:

Stored size: 718 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
    end

    def time(val)
      sleep val
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
webdrone-0.7.6 lib/webdrone/wait.rb
webdrone-0.7.2 lib/webdrone/wait.rb
webdrone-0.7.0 lib/webdrone/wait.rb
webdrone-0.6.0 lib/webdrone/wait.rb
webdrone-0.5.0 lib/webdrone/wait.rb
webdrone-0.4.0 lib/webdrone/wait.rb
webdrone-0.3.0 lib/webdrone/wait.rb
webdrone-0.2.0 lib/webdrone/wait.rb