Method: PageObject::Accessors#text_area

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

#text_area(name, identifier = {:index => 0}, &block) ⇒ Object Also known as: textarea

adds four methods to the page object - one to set text in a text area, another to retrieve text from a text area, another to return the text area element, and another to check the text area’s existence.

Examples:

text_area(:address, :id => "address")
# will generate 'address', 'address=', 'address_element',
# 'address?' methods

Parameters:

  • the (String)

    name used for the generated methods

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

    how we find a text area.

  • optional

    block to be invoked when element method is called



270
271
272
273
274
275
276
277
278
279
280
# File 'lib/page-object/accessors.rb', line 270

def text_area(name, identifier={:index => 0}, &block)
  standard_methods(name, identifier, 'text_area_for', &block)
  define_method(name) do
    return platform.text_area_value_for identifier.clone unless block_given?
    self.send("#{name}_element").value
  end
  define_method("#{name}=") do |value|
    return platform.text_area_value_set(identifier.clone, value) unless block_given?
    self.send("#{name}_element").value = value
  end
end