Class: TestCentricity::AppElements::AppTextField
- Inherits:
-
AppUIElement
- Object
- AppUIElement
- TestCentricity::AppElements::AppTextField
- Defined in:
- lib/testcentricity_apps/app_elements/textfield.rb
Instance Attribute Summary
Attributes inherited from AppUIElement
#context, #locator, #mru_app_session, #mru_locator, #mru_object, #mru_parent, #name, #parent, #type
Instance Method Summary collapse
-
#get_max_length ⇒ Integer
Return maxlength character count of a text field.
-
#get_placeholder ⇒ String
Return placeholder text of a text field.
-
#initialize(name, parent, locator, context) ⇒ AppTextField
constructor
A new instance of AppTextField.
-
#read_only? ⇒ Boolean
Is text field set to read-only?.
Methods inherited from AppUIElement
#clear, #click, #count, #disabled?, #double_tap, #drag_and_drop, #drag_by, #element, #enabled?, #exists?, #get_attribute, #get_caption, #get_locator, #get_name, #get_object_type, #get_value, #height, #hidden?, #hover, #id, #identifier, #long_press, #reset_mru_cache, #scroll_into_view, #selected?, #send_keys, #set, #swipe_gesture, #tap, #visible?, #wait_until_enabled, #wait_until_exists, #wait_until_gone, #wait_until_hidden, #wait_until_value_changes, #wait_until_value_is, #wait_until_visible, #width, #x_loc, #y_loc
Constructor Details
#initialize(name, parent, locator, context) ⇒ AppTextField
Returns a new instance of AppTextField.
4 5 6 7 |
# File 'lib/testcentricity_apps/app_elements/textfield.rb', line 4 def initialize(name, parent, locator, context) super @type = :textfield end |
Instance Method Details
#get_max_length ⇒ Integer
Return maxlength character count of a text field.
27 28 29 30 31 32 |
# File 'lib/testcentricity_apps/app_elements/textfield.rb', line 27 def get_max_length obj = element object_not_found_exception(obj) max_length = obj.attribute('maxlength') max_length.to_i unless max_length.blank? end |
#get_placeholder ⇒ String
Return placeholder text of a text field.
40 41 42 43 44 45 46 47 48 |
# File 'lib/testcentricity_apps/app_elements/textfield.rb', line 40 def get_placeholder obj = element object_not_found_exception(obj) if AppiumConnect.is_webview? obj.attribute('placeholder') else obj.text end end |
#read_only? ⇒ Boolean
Is text field set to read-only?
15 16 17 18 19 |
# File 'lib/testcentricity_apps/app_elements/textfield.rb', line 15 def read_only? obj = element object_not_found_exception(obj) !!obj.attribute('readonly') end |