lib/appium_lib/android/helper.rb in appium_lib-9.3.4 vs lib/appium_lib/android/helper.rb in appium_lib-9.3.5

- old
+ new

@@ -254,11 +254,11 @@ # @param string [String] the string check for a resourceId # value will be auto unquoted # @param on_match [String] the string to return on resourceId match # # @return [String] empty string on failure, on_match on successful match - def _resource_id(string, on_match) + def resource_id(string, on_match) return '' unless string # unquote the string # "com.example.Test:id/enter" -> com.example.Test:id/enter unquote = string.match(/"(.+)"/) @@ -287,18 +287,18 @@ # @return [String] def string_visible_contains(class_name, value) value = %("#{value}") if class_name == '*' - return (_resource_id(value, "new UiSelector().resourceId(#{value});") + + return (resource_id(value, "new UiSelector().resourceId(#{value});") + "new UiSelector().descriptionContains(#{value});" \ "new UiSelector().textContains(#{value});") end class_name = %("#{class_name}") - _resource_id(value, "new UiSelector().className(#{class_name}).resourceId(#{value});") + + resource_id(value, "new UiSelector().className(#{class_name}).resourceId(#{value});") + "new UiSelector().className(#{class_name}).descriptionContains(#{value});" \ "new UiSelector().className(#{class_name}).textContains(#{value});" end # Find the first element that contains value @@ -324,17 +324,17 @@ # @return [String] def string_visible_exact(class_name, value) value = %("#{value}") if class_name == '*' - return (_resource_id(value, "new UiSelector().resourceId(#{value});") + + return (resource_id(value, "new UiSelector().resourceId(#{value});") + "new UiSelector().description(#{value});" \ "new UiSelector().text(#{value});") end class_name = %("#{class_name}") - _resource_id(value, "new UiSelector().className(#{class_name}).resourceId(#{value});") + + resource_id(value, "new UiSelector().className(#{class_name}).resourceId(#{value});") + "new UiSelector().className(#{class_name}).description(#{value});" \ "new UiSelector().className(#{class_name}).text(#{value});" end # Find the first element exactly matching value