Method: PageObject::Accessors#text_field
- Defined in:
- lib/page-object/accessors.rb
#text_field(name, identifier = {:index => 0}, &block) ⇒ Object
adds four methods to the page object - one to set text in a text field, another to retrieve text from a text field, another to return the text field element, another to check the text field’s existence.
196 197 198 199 200 201 202 203 204 205 206 |
# File 'lib/page-object/accessors.rb', line 196 def text_field(name, identifier={:index => 0}, &block) standard_methods(name, identifier, 'text_field_for', &block) define_method(name) do return platform.text_field_value_for identifier.clone unless block_given? self.send("#{name}_element").value end define_method("#{name}=") do |value| return platform.text_field_value_set(identifier.clone, value) unless block_given? self.send("#{name}_element").value = value end end |