lib/appium_lib/android/uiautomator2/helper.rb in appium_lib-9.15.1 vs lib/appium_lib/android/uiautomator2/helper.rb in appium_lib-9.15.2

- old
+ new

@@ -12,27 +12,28 @@ # @return [String] def string_visible_contains(class_name, value) value = %("#{value}") if class_name == '*' return (resource_id(value, "new UiSelector().resourceId(#{value});") + - "new UiSelector().descriptionContains(#{value});" \ - "new UiSelector().textContains(#{value});") + "new UiSelector().descriptionContains(#{value});" \ + "new UiSelector().textContains(#{value});") end class_name = %("#{class_name}") resource_id(value, "new UiSelector().className(#{class_name}).resourceId(#{value});") + - "new UiSelector().className(#{class_name}).descriptionContains(#{value});" \ - "new UiSelector().className(#{class_name}).textContains(#{value});" + "new UiSelector().className(#{class_name}).descriptionContains(#{value});" \ + "new UiSelector().className(#{class_name}).textContains(#{value});" end # Find the first element that contains value # @param class_name [String] the class name for the element # @param value [String] the value to search for # @return [Element] def complex_find_contains(class_name, value) elements = find_elements :uiautomator, string_visible_contains(class_name, value) raise _no_such_element if elements.empty? + elements.first end # Find all elements containing value # @param class_name [String] the class name for the element @@ -50,26 +51,27 @@ def string_visible_exact(class_name, value) value = %("#{value}") if class_name == '*' return (resource_id(value, "new UiSelector().resourceId(#{value});") + - "new UiSelector().description(#{value});" \ - "new UiSelector().text(#{value});") + "new UiSelector().description(#{value});" \ + "new UiSelector().text(#{value});") end class_name = %("#{class_name}") resource_id(value, "new UiSelector().className(#{class_name}).resourceId(#{value});") + - "new UiSelector().className(#{class_name}).description(#{value});" \ - "new UiSelector().className(#{class_name}).text(#{value});" + "new UiSelector().className(#{class_name}).description(#{value});" \ + "new UiSelector().className(#{class_name}).text(#{value});" end # Find the first element exactly matching value # @param class_name [String] the class name for the element # @param value [String] the value to search for # @return [Element] def complex_find_exact(class_name, value) elements = find_elements :uiautomator, string_visible_exact(class_name, value) raise _no_such_element if elements.empty? + elements.first end # Find all elements exactly matching value # @param class_name [String] the class name for the element