Sha256: b4bf3029a0b1681ea29f837a05cc38e06f72fcf2a03562e00bdef6852537789b
Contents?: true
Size: 1.62 KB
Versions: 15
Compression:
Stored size: 1.62 KB
Contents
module TestCentricity class Radio < UIElement def initialize(parent, locator, context) @parent = parent @locator = locator @context = context @type = :radio @alt_locator = nil end # Does radio button object exists? # # @return [Boolean] # @example # accept_terms_radio.exists? # def exists? obj, _ = find_object(:all) obj != nil end # Is radio button selected? # # @return [Boolean] # @example # accept_terms_radio.selected? # def selected? obj, _ = find_element(:all) object_not_found_exception(obj, 'Radio') obj.checked? end # Set the select state of a radio button object. # # @param state [Boolean] true = selected / false = unselected # @example # accept_terms_radio.set_selected_state(true) # def set_selected_state(state) obj, _ = find_element(:all) object_not_found_exception(obj, 'Radio') invalid_object_type_exception(obj, 'radio') begin obj.set(state) rescue unless state == obj.checked? check_id = obj.native.attribute('id') label = first("label[for='#{check_id}']", :wait => 1, :visible => true) label.click unless label.nil? end end end # Set the selected state of a radio button object. # # @example # accept_terms_radio.select # def select set_selected_state(true) end # Unselect a radio button object. # # @example # accept_terms_radio.unselect # def unselect set_selected_state(false) end end end
Version data entries
15 entries across 15 versions & 1 rubygems