Class: TestSteps::Handlers::WriteBoxdata
- Defined in:
- lib/functions/handlers/write_box_data.rb
Overview
Write box data 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 34 35 |
# File 'lib/functions/handlers/write_box_data.rb', line 11 def perform(step_attributes) box = step_attributes[:testvalue] value = step_attributes[:testvalue2] locate = step_attributes[:locate] txt = ENV[value.to_s] || step_attributes[:testvalue2] elms = i[textarea text_field iframe] found_box = elms.map do |elm| Browser.b.send(elm, "#{locate}": box).exists? end.compact raise 'Multiple matches' if found_box.select { |i| i }.empty? index = found_box.index(true) return unless index Browser.b.send(elms[index], "#{locate}": box) .wait_until(&:exists?).send_keys txt MyLog.log.info("Textbox: #{box} has correct value: #{txt}") true rescue StandardError MyLog.log.warn("Textbox: #{box} does not exist") false end |