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