Method: PageObject::Accessors#b

Defined in:
lib/page-object/accessors.rb

#b(name, identifier = {:index => 0}, &block) ⇒ Object

adds three methods - one to retrieve the text of a b element, another to retrieve a b element, and another to check for it’s existence.

Examples:

b(:bold, :id => 'title')
# will generate 'bold', 'bold_element', and 'bold?' methods

Parameters:

  • the (Symbol)

    name used for the generated methods

  • identifier (Hash) (defaults to: {:index => 0})

    how we find a b. You can use a multiple parameters by combining of any of the following except xpath. The valid keys are:

    • :class => Watir and Selenium

    • :css => Watir and Selenium

    • :id => Watir and Selenium

    • :index => Watir and Selenium

    • :name => Watir and Selenium

    • :xpath => Watir and Selenium

  • optional

    block to be invoked when element method is called



1170
1171
1172
1173
1174
1175
1176
# File 'lib/page-object/accessors.rb', line 1170

def b(name, identifier={:index => 0}, &block)
  standard_methods(name, identifier,'b_for', &block)
  define_method(name) do
    return platform.b_text_for identifier.clone unless block_given?
    self.send("#{name}_element").text
  end
end