class Capybara::UI::RadioButton
A radio button.
Public Class Methods
root(selector)
click to toggle source
Calls superclass method
Capybara::UI::Field::root
# File lib/capybara/ui/widgets/radio_button.rb, line 17 def self.root(selector) super(["#{selector}"]) end
Public Instance Methods
get()
click to toggle source
@return [String] The text of the checked button's label.
# File lib/capybara/ui/widgets/radio_button.rb, line 22 def get if visible?(:checked_label_by_value, value) widget(:checked_label_by_value, value).text elsif visible?(:checked_label_by_id, id) widget(:checked_label_by_id, id).text else nil end end
id()
click to toggle source
@return [String] The id of the checked button.
# File lib/capybara/ui/widgets/radio_button.rb, line 38 def id visible?(:checked) ? widget(:checked).id : nil end
set(str)
click to toggle source
First attempts to choose the button by id or label text Then attempts to choose the button by value
# File lib/capybara/ui/widgets/radio_button.rb, line 44 def set(str) root.choose(str) rescue begin widget(:button_by_value, str).root.set(true) rescue Capybara::UI::MissingWidget => e raise InvalidRadioButton.new(e.message). tap { |x| x.set_backtrace e.backtrace } end end
to_cell()
click to toggle source
# File lib/capybara/ui/widgets/radio_button.rb, line 59 def to_cell get end
value()
click to toggle source
@return [String] The value of the checked button.
# File lib/capybara/ui/widgets/radio_button.rb, line 33 def value visible?(:checked) ? widget(:checked).root.value : nil end