module RegressyCommon::Clicker

Public Instance Methods

click_with_rescue(how, what) click to toggle source
# File lib/regressy_common/clicker.rb, line 17
def click_with_rescue(how, what)
  @driver.find_element(how, what).click
  true
rescue => e
  logger.info "#{e.inspect}, at click_with_rescue"
  false
end
failure_message(*params) click to toggle source
# File lib/regressy_common/clicker.rb, line 25
def failure_message(*params)
  "#{caller[0][/`([^']*)'/, 1]} is failed. #{params}"
end
retry_click(how, what, max=10) { || ... } click to toggle source
# File lib/regressy_common/clicker.rb, line 3
def retry_click(how, what, max=10)
  max.times do |c|
    if click_with_rescue(how, what)
      break
    end
    yield if block_given?
    if c >= max-1
      message = "retry_click count is over. how:#{how}, what:#{what}, count:#{c}"
      raise Selenium::WebDriver::Error::UnknownError, message
    end
    sleep 1
  end
end