Module: IEgrip::Retry

Included in:
Document, ElementChild, Frame, Frames, GetElements, HTMLElement, HTMLElementCollection
Defined in:
lib/iegrip.rb

Constant Summary collapse

RETRY_INTERVAL =
0.1

Instance Method Summary collapse

Instance Method Details

#retryCheck(&proc) ⇒ Object



74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/iegrip.rb', line 74

def retryCheck(&proc)
  #puts "retryCheck() start...."

  retry_count = (@ie_obj.timeout / RETRY_INTERVAL).to_i
  retry_count.times do
    check_result = proc.call
    #puts "  in retryCheck(), check_result = #{check_result.inspect}"

    if check_result
      #puts "retryCheck() Success fin."

      return check_result 
    end
    sleep RETRY_INTERVAL
  end
  #puts "retryCheck(), return nil."

  return nil
end

#retryGetTarget(&proc) ⇒ Object



58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/iegrip.rb', line 58

def retryGetTarget(&proc)
  #puts "retryGetTarget() start.... proc = #{proc.inspect}"

  retry_count = (@ie_obj.timeout / RETRY_INTERVAL).to_i
  retry_count.times do
    target = proc.call
    #puts "  in retryGetTarget(), target = #{target.inspect}"

    if target
      #puts "retryGetTarget() Success fin."

      return target 
    end
    sleep RETRY_INTERVAL
  end
  #puts "retryGetTarget(), return nil."

  return nil
end