Module: Appium::Ios::Xcuitest::Element
- Defined in:
- lib/appium_lib/ios/xcuitest/element.rb,
lib/appium_lib/ios/xcuitest/element/text.rb,
lib/appium_lib/ios/xcuitest/element/button.rb,
lib/appium_lib/ios/xcuitest/element/generic.rb,
lib/appium_lib/ios/xcuitest/element/textfield.rb
Instance Method Summary collapse
-
#button(value) ⇒ UIA_BUTTON|XCUIELEMENT_TYPE_BUTTON
Find the first UIAButton|XCUIElementTypeButton that contains value or by index.
-
#button_class ⇒ String
Class name for button.
-
#button_exact(value) ⇒ UIA_BUTTON|XCUIELEMENT_TYPE_BUTTON
Find the first UIAButton|XCUIElementTypeButton that exactly matches value.
-
#buttons(value = false) ⇒ Array<UIA_BUTTON|XCUIELEMENT_TYPE_BUTTON>
Find all UIAButtons|XCUIElementTypeButtons containing value.
-
#buttons_exact(value) ⇒ Array<UIA_BUTTON|XCUIELEMENT_TYPE_BUTTON>
Find all UIAButtons|XCUIElementTypeButtons that exactly match value.
-
#find(value) ⇒ Element
Find the first element containing value.
-
#find_exact(value) ⇒ Element
Find the first element exactly matching value.
-
#finds(value) ⇒ Array<Element>
Find all elements containing value.
-
#finds_exact(value) ⇒ Array<Element>
Find all elements exactly matching value.
-
#first_button ⇒ UIA_BUTTON|XCUIELEMENT_TYPE_BUTTON
Find the first UIAButton|XCUIElementTypeButton.
-
#first_text ⇒ UIA_STATIC_TEXT|XCUIELEMENT_TYPE_STATIC_TEXT
Find the first UIAStaticText|XCUIElementTypeStaticText.
-
#first_textfield ⇒ TextField
Find the first TextField.
-
#last_button ⇒ UIA_BUTTON|XCUIELEMENT_TYPE_BUTTON
TODO: add documentation regarding previous element.
-
#last_text ⇒ UIA_STATIC_TEXT|XCUIELEMENT_TYPE_STATIC_TEXT
Find the last UIAStaticText|XCUIElementTypeStaticText.
-
#last_textfield ⇒ TextField
Find the last TextField.
-
#secure_text_field_class ⇒ String
Class name for secure text field.
-
#static_text_class ⇒ String
Class name for text.
-
#text(value) ⇒ UIA_STATIC_TEXT|XCUIELEMENT_TYPE_STATIC_TEXT
Find the first UIAStaticText|XCUIElementTypeStaticText that contains value or by index.
-
#text_exact(value) ⇒ UIA_STATIC_TEXT|XCUIELEMENT_TYPE_STATIC_TEXT
Find the first UIAStaticText|XCUIElementTypeStaticText that exactly matches value.
-
#text_field_class ⇒ String
Class name for text field.
-
#textfield(value) ⇒ TextField
Find the first TextField that contains value or by index.
-
#textfield_exact(value) ⇒ TextField
Find the first TextField that exactly matches value.
-
#textfields(value = false) ⇒ Array<TextField>
Find all TextFields containing value.
-
#textfields_exact(value) ⇒ Array<TextField>
Find all TextFields that exactly match value.
-
#texts(value = false) ⇒ Array<UIA_STATIC_TEXT|XCUIELEMENT_TYPE_STATIC_TEXT>
Find all UIAStaticTexts|XCUIElementTypeStaticTexts containing value.
-
#texts_exact(value) ⇒ Array<UIA_STATIC_TEXT|XCUIELEMENT_TYPE_STATIC_TEXT>
Find all UIAStaticTexts|XCUIElementTypeStaticTexts that exactly match value.
Instance Method Details
#button(value) ⇒ UIA_BUTTON|XCUIELEMENT_TYPE_BUTTON
Find the first UIAButton|XCUIElementTypeButton that contains value or by index. If int then the UIAButton|XCUIElementTypeButton at that index is returned.
31 32 33 34 35 36 |
# File 'lib/appium_lib/ios/xcuitest/element/button.rb', line 31 def (value) # return button at index. return ele_index , value if value.is_a? Numeric raise_error_if_no_element (value).first end |
#button_class ⇒ String
Returns Class name for button.
23 24 25 |
# File 'lib/appium_lib/ios/xcuitest/element/button.rb', line 23 def ::Appium::Ios::XCUIELEMENT_TYPE_BUTTON end |
#button_exact(value) ⇒ UIA_BUTTON|XCUIELEMENT_TYPE_BUTTON
Find the first UIAButton|XCUIElementTypeButton that exactly matches value.
66 67 68 |
# File 'lib/appium_lib/ios/xcuitest/element/button.rb', line 66 def (value) raise_error_if_no_element (value).first end |
#buttons(value = false) ⇒ Array<UIA_BUTTON|XCUIELEMENT_TYPE_BUTTON>
Find all UIAButtons|XCUIElementTypeButtons containing value. If value is omitted, all UIAButtons|XCUIElementTypeButtons are returned.
42 43 44 45 46 47 |
# File 'lib/appium_lib/ios/xcuitest/element/button.rb', line 42 def (value = false) return unless value elements = find_eles_by_predicate_include(class_name: , value: value) select_visible_elements elements end |
#buttons_exact(value) ⇒ Array<UIA_BUTTON|XCUIELEMENT_TYPE_BUTTON>
Find all UIAButtons|XCUIElementTypeButtons that exactly match value.
73 74 75 76 |
# File 'lib/appium_lib/ios/xcuitest/element/button.rb', line 73 def (value) elements = find_eles_by_predicate(class_name: , value: value) select_visible_elements elements end |
#find(value) ⇒ Element
Find the first element containing value
22 23 24 |
# File 'lib/appium_lib/ios/xcuitest/element/generic.rb', line 22 def find(value) raise_error_if_no_element finds(value).first end |
#find_exact(value) ⇒ Element
Find the first element exactly matching value
37 38 39 |
# File 'lib/appium_lib/ios/xcuitest/element/generic.rb', line 37 def find_exact(value) raise_error_if_no_element finds_exact(value).first end |
#finds(value) ⇒ Array<Element>
Find all elements containing value
29 30 31 32 |
# File 'lib/appium_lib/ios/xcuitest/element/generic.rb', line 29 def finds(value) elements = find_eles_by_predicate_include value: value select_visible_elements elements end |
#finds_exact(value) ⇒ Array<Element>
Find all elements exactly matching value
44 45 46 47 |
# File 'lib/appium_lib/ios/xcuitest/element/generic.rb', line 44 def finds_exact(value) elements = find_eles_by_predicate value: value select_visible_elements elements end |
#first_button ⇒ UIA_BUTTON|XCUIELEMENT_TYPE_BUTTON
Find the first UIAButton|XCUIElementTypeButton.
51 52 53 |
# File 'lib/appium_lib/ios/xcuitest/element/button.rb', line 51 def first_ele end |
#first_text ⇒ UIA_STATIC_TEXT|XCUIELEMENT_TYPE_STATIC_TEXT
Find the first UIAStaticText|XCUIElementTypeStaticText.
50 51 52 |
# File 'lib/appium_lib/ios/xcuitest/element/text.rb', line 50 def first_text first_ele static_text_class end |
#first_textfield ⇒ TextField
Find the first TextField.
66 67 68 |
# File 'lib/appium_lib/ios/xcuitest/element/textfield.rb', line 66 def first_textfield _textfield_with_predicate end |
#last_button ⇒ UIA_BUTTON|XCUIELEMENT_TYPE_BUTTON
TODO: add documentation regarding previous element.
Previous UIAElement is differ from UIAButton|XCUIElementTypeButton. So, the results are different.
Find the last UIAButton|XCUIElementTypeButton.
59 60 61 |
# File 'lib/appium_lib/ios/xcuitest/element/button.rb', line 59 def last_ele end |
#last_text ⇒ UIA_STATIC_TEXT|XCUIELEMENT_TYPE_STATIC_TEXT
Find the last UIAStaticText|XCUIElementTypeStaticText.
56 57 58 |
# File 'lib/appium_lib/ios/xcuitest/element/text.rb', line 56 def last_text last_ele static_text_class end |
#last_textfield ⇒ TextField
Find the last TextField.
72 73 74 75 76 77 |
# File 'lib/appium_lib/ios/xcuitest/element/textfield.rb', line 72 def last_textfield result = _textfields_with_predicate.last raise _no_such_element if result.nil? result end |
#secure_text_field_class ⇒ String
Returns Class name for secure text field.
28 29 30 |
# File 'lib/appium_lib/ios/xcuitest/element/textfield.rb', line 28 def secure_text_field_class ::Appium::Ios::XCUIELEMENT_TYPE_SECURE_TEXT_FIELD end |
#static_text_class ⇒ String
Returns Class name for text.
23 24 25 |
# File 'lib/appium_lib/ios/xcuitest/element/text.rb', line 23 def static_text_class ::Appium::Ios::XCUIELEMENT_TYPE_STATIC_TEXT end |
#text(value) ⇒ UIA_STATIC_TEXT|XCUIELEMENT_TYPE_STATIC_TEXT
Find the first UIAStaticText|XCUIElementTypeStaticText that contains value or by index. If int then the UIAStaticText|XCUIElementTypeStaticText at that index is returned.
31 32 33 34 35 |
# File 'lib/appium_lib/ios/xcuitest/element/text.rb', line 31 def text(value) return ele_index static_text_class, value if value.is_a? Numeric raise_error_if_no_element texts(value).first end |
#text_exact(value) ⇒ UIA_STATIC_TEXT|XCUIELEMENT_TYPE_STATIC_TEXT
Find the first UIAStaticText|XCUIElementTypeStaticText that exactly matches value.
63 64 65 |
# File 'lib/appium_lib/ios/xcuitest/element/text.rb', line 63 def text_exact(value) raise_error_if_no_element texts_exact(value).first end |
#text_field_class ⇒ String
Returns Class name for text field.
23 24 25 |
# File 'lib/appium_lib/ios/xcuitest/element/textfield.rb', line 23 def text_field_class ::Appium::Ios::XCUIELEMENT_TYPE_TEXT_FIELD end |
#textfield(value) ⇒ TextField
Find the first TextField that contains value or by index. Note: Uses XPath If int then the TextField at that index is returned.
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/appium_lib/ios/xcuitest/element/textfield.rb', line 37 def textfield(value) if value.is_a? Numeric index = value raise ArgumentError, "#{index} is not a valid index. Must be >= 1" if index <= 0 index -= 1 # eles_by_json and _textfields_with_predicate is 0 indexed. result = _textfields_with_predicate[index] raise _no_such_element if result.nil? return result end raise_error_if_no_element textfields(value).first end |
#textfield_exact(value) ⇒ TextField
Find the first TextField that exactly matches value.
82 83 84 |
# File 'lib/appium_lib/ios/xcuitest/element/textfield.rb', line 82 def textfield_exact(value) raise_error_if_no_element textfields_exact(value).first end |
#textfields(value = false) ⇒ Array<TextField>
Find all TextFields containing value. If value is omitted, all TextFields are returned.
57 58 59 60 61 62 |
# File 'lib/appium_lib/ios/xcuitest/element/textfield.rb', line 57 def textfields(value = false) return (class_names: [text_field_class, secure_text_field_class]) unless value elements = class_names: [text_field_class, secure_text_field_class], value: value select_visible_elements elements end |
#textfields_exact(value) ⇒ Array<TextField>
Find all TextFields that exactly match value.
89 90 91 92 |
# File 'lib/appium_lib/ios/xcuitest/element/textfield.rb', line 89 def textfields_exact(value) elements = class_names: [text_field_class, secure_text_field_class], value: value select_visible_elements elements end |
#texts(value = false) ⇒ Array<UIA_STATIC_TEXT|XCUIELEMENT_TYPE_STATIC_TEXT>
Find all UIAStaticTexts|XCUIElementTypeStaticTexts containing value. If value is omitted, all UIAStaticTexts|XCUIElementTypeStaticTexts are returned
41 42 43 44 45 46 |
# File 'lib/appium_lib/ios/xcuitest/element/text.rb', line 41 def texts(value = false) return static_text_class unless value elements = find_eles_by_predicate_include(class_name: static_text_class, value: value) select_visible_elements elements end |
#texts_exact(value) ⇒ Array<UIA_STATIC_TEXT|XCUIELEMENT_TYPE_STATIC_TEXT>
Find all UIAStaticTexts|XCUIElementTypeStaticTexts that exactly match value.
70 71 72 73 |
# File 'lib/appium_lib/ios/xcuitest/element/text.rb', line 70 def texts_exact(value) elements = find_eles_by_predicate(class_name: static_text_class, value: value) select_visible_elements elements end |