Module: TextFieldHelper
- Defined in:
- lib/watir_helper/textfield_helper.rb
Instance Method Summary collapse
-
#clear_textfield(browser_handle, property, property_value) ⇒ Object
Clear a texfield.
-
#exists_textfield?(browser_handle, property, property_value) ⇒ Boolean
Check whether a textfield exists or not.
-
#flash_textfield(browser_handle, property, property_value) ⇒ Object
Highlight or Flash a textfield.
-
#get_textfield_contents(browser_handle, property, property_value) ⇒ Object
Get the text from the textfield.
-
#is_blank_textfield?(browser_handle, property, property_value) ⇒ Boolean
Check whether a textfield is blank or not.
-
#set_textfield(browser_handle, property, property_value, settextvalue) ⇒ Object
Set a texfield with a text.
-
#textfield_contains_value?(browser_handle, property, property_value, val) ⇒ Boolean
TextField contains a value or not.
Instance Method Details
#clear_textfield(browser_handle, property, property_value) ⇒ Object
Clear a texfield.
19 20 21 |
# File 'lib/watir_helper/textfield_helper.rb', line 19 def clear_textfield(browser_handle, property, property_value) browser_handle.text_field(property.intern, /#{property_value}/).clear end |
#exists_textfield?(browser_handle, property, property_value) ⇒ Boolean
Check whether a textfield exists or not.
34 35 36 |
# File 'lib/watir_helper/textfield_helper.rb', line 34 def exists_textfield?(browser_handle, property, property_value) browser_handle.text_field(property.intern, /#{property_value}/).exists? end |
#flash_textfield(browser_handle, property, property_value) ⇒ Object
Highlight or Flash a textfield.
29 30 31 |
# File 'lib/watir_helper/textfield_helper.rb', line 29 def flash_textfield(browser_handle, property, property_value) browser_handle.text_field(property.intern, /#{property_value}/).flash end |
#get_textfield_contents(browser_handle, property, property_value) ⇒ Object
Get the text from the textfield.
14 15 16 |
# File 'lib/watir_helper/textfield_helper.rb', line 14 def get_textfield_contents(browser_handle, property, property_value) browser_handle.text_field(property.intern, /#{property_value}/).value end |
#is_blank_textfield?(browser_handle, property, property_value) ⇒ Boolean
Check whether a textfield is blank or not.
39 40 41 |
# File 'lib/watir_helper/textfield_helper.rb', line 39 def is_blank_textfield?(browser_handle, property, property_value) [nil, ""].include?(get_textfield_contents(browser_handle, property, property_value)) ? true : false end |
#set_textfield(browser_handle, property, property_value, settextvalue) ⇒ Object
Set a texfield with a text.
9 10 11 |
# File 'lib/watir_helper/textfield_helper.rb', line 9 def set_textfield(browser_handle, property, property_value, settextvalue) browser_handle.text_field(property.intern, /#{property_value}/).set settextvalue.to_s end |
#textfield_contains_value?(browser_handle, property, property_value, val) ⇒ Boolean
TextField contains a value or not
24 25 26 |
# File 'lib/watir_helper/textfield_helper.rb', line 24 def textfield_contains_value?(browser_handle, property, property_value, val) get_textfield_contents(browser_handle, property, property_value) == val ? true : false end |