Class: Watir::TextField
- Inherits:
-
Input
- Object
- BaseElement
- HTMLElement
- Input
- Watir::TextField
- Defined in:
- lib/watir-webdriver/elements/text_field.rb
Constant Summary
Constants inherited from BaseElement
BaseElement::IGNORED_ATTRIBUTES
Instance Method Summary collapse
-
#append(*args) ⇒ Object
Append the given value to the text in the text field.
-
#clear ⇒ Object
Clear the text field.
- #inspect ⇒ Object
-
#set(*args) ⇒ Object
(also: #value=)
Clear the element, the type in the given value.
-
#type ⇒ Object
hacky, but we want Input#type here, which was overriden by TextArea’s attributes so we’re overwriting that method definition here.
-
#value ⇒ Object
Returns the text in the text field.
Methods inherited from Input
#enabled?, #to_button, #to_checkbox, #to_radio, #to_select_list
Methods inherited from BaseElement
attribute_list, #attribute_value, attributes, #click, #double_click, #driver, #element, #exists?, #fire_event, #flash, #focus, #html, #initialize, #parent, #right_click, #run_checkers, #send_keys, #style, #tag_name, #text, typed_attributes, #visible?
Methods included from Container
Methods included from XpathSupport
#element_by_xpath, #elements_by_xpath
Constructor Details
This class inherits a constructor from Watir::BaseElement
Instance Method Details
#append(*args) ⇒ Object
Append the given value to the text in the text field.
35 36 37 38 39 40 |
# File 'lib/watir-webdriver/elements/text_field.rb', line 35 def append(*args) assert_exists assert_writable @element.send_keys(*args) end |
#clear ⇒ Object
Clear the text field.
46 47 48 49 |
# File 'lib/watir-webdriver/elements/text_field.rb', line 46 def clear assert_exists @element.clear end |
#inspect ⇒ Object
14 15 16 |
# File 'lib/watir-webdriver/elements/text_field.rb', line 14 def inspect '#<%s:0x%x located=%s selector=%s>' % [self.class, hash*2, !!@element, selector_string] end |
#set(*args) ⇒ Object Also known as: value=
Clear the element, the type in the given value.
22 23 24 25 26 27 28 |
# File 'lib/watir-webdriver/elements/text_field.rb', line 22 def set(*args) assert_exists assert_writable @element.clear @element.send_keys(*args) end |
#type ⇒ Object
hacky, but we want Input#type here, which was overriden by TextArea’s attributes so we’re overwriting that method definition here
9 |
# File 'lib/watir-webdriver/elements/text_field.rb', line 9 def type; super; end |
#value ⇒ Object
Returns the text in the text field.
55 56 57 58 59 |
# File 'lib/watir-webdriver/elements/text_field.rb', line 55 def value # since 'value' is an attribute on input fields, we override this here assert_exists @element.value end |