Sha256: cbe5f462e1257f668fb656162752dfc83e28d518653dd9345c66b3cc6226886c
Contents?: true
Size: 833 Bytes
Versions: 37
Compression:
Stored size: 833 Bytes
Contents
# encoding: utf-8 module Watir module Wait extend self class TimeoutError < StandardError end # # Wait until the block evaluates to true or times out. # def until(timeout = 60, &block) end_time = ::Time.now + timeout until ::Time.now > end_time result = yield(self) return result if result sleep 0.1 end raise TimeoutError, "timed out after #{timeout} seconds" end # # Wait while the block evaluates to true or times out. # def while(timeout = 60, &block) end_time = ::Time.now + timeout until ::Time.now > end_time return unless yield(self) sleep 0.1 end raise TimeoutError, "timed out after #{timeout} seconds" end end # Wait end # Watir
Version data entries
37 entries across 37 versions & 2 rubygems