Class: TestSteps::Handlers::ClickButton
- Defined in:
- lib/functions/handlers/click_button.rb
Overview
Click Button function.
Instance Method Summary collapse
Methods inherited from Base
#login_button, #login_check, #login_process, #mem_word_check, #open_url_process, perform, #portal_mem_word, register
Instance Method Details
#perform(step_attributes) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/functions/handlers/click_button.rb', line 11 def perform(step_attributes) = step_attributes[:testvalue] locate = step_attributes[:locate] elms = %i[button span a div link image h1 h2 h3 h4] = elms.map do |elm| Browser.b.send(elm, "#{locate}": ).exists? end.compact raise 'Multiple matches' if .select { |i| i }.empty? index = .index(true) return unless index Browser.b.send(elms[index], "#{locate}": ) .wait_until(&:exists?).click MyLog.log.info("Button: #{} has been selected") true rescue StandardError MyLog.log.warn("Button: #{} does not exist") false end |