Method: PageObject::Accessors#radio_button
- Defined in:
- lib/page-object/accessors.rb
#radio_button(name, identifier = nil, &block) ⇒ Object
adds five methods - one to select, another to clear, another to return if a radio button is selected, another method to return a PageObject::Elements::RadioButton object representing the radio button element, and another to check the radio button’s existence.
359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 |
# File 'lib/page-object/accessors.rb', line 359 def (name, identifier=nil, &block) define_method("select_#{name}") do return platform.select_radio(identifier.clone) unless block_given? self.send("#{name}_element").select end define_method("clear_#{name}") do return platform.clear_radio(identifier.clone) unless block_given? self.send("#{name}_element").clear end define_method("#{name}_selected?") do return platform.radio_selected?(identifier.clone) unless block_given? self.send("#{name}_element").selected? end define_method("#{name}_element") do return call_block(&block) if block_given? platform.(identifier.clone) end define_method("#{name}?") do return call_block(&block).exists? if block_given? platform.(identifier.clone).exists? end alias_method "#{name}_radio_button".to_sym, "#{name}_element".to_sym end |