Module: RegressyCommon::Clicker
- Defined in:
- lib/regressy_common/clicker.rb
Instance Method Summary collapse
- #click_with_rescue(how, what) ⇒ Object
- #failure_message(*params) ⇒ Object
- #retry_click(how, what, max = 10) ⇒ Object
Instance Method Details
#click_with_rescue(how, what) ⇒ Object
17 18 19 20 21 22 23 |
# 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) ⇒ Object
25 26 27 |
# File 'lib/regressy_common/clicker.rb', line 25 def (*params) "#{caller[0][/`([^']*)'/, 1]} is failed. #{params}" end |
#retry_click(how, what, max = 10) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 |
# 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 = "retry_click count is over. how:#{how}, what:#{what}, count:#{c}" raise Selenium::WebDriver::Error::UnknownError, end sleep 1 end end |