/// <summary> /// Perform a scroll forward action to move through the scrollable layout element until a visible item that matches the selector is found. /// Maps to: UiScrollable.scrollIntoView(UiSelector selector) method (see remarks). /// </summary> /// <param name="selector"></param> /// /// <param name="value"></param> /// <remarks>https://developer.android.com/reference/androidx/test/uiautomator/UiScrollable#scrollIntoView(androidx.test.uiautomator.UiSelector)</remarks> private void ScrollIntoView2(Selector selector, string value) { _stringBuilder.Append(".scrollIntoView("); _stringBuilder.Append(MiscUiAutomator.ReBuildString(selector)); _stringBuilder.Append("(\""); _stringBuilder.Append(value); _stringBuilder.Append("\"))"); }
/// <summary> /// Searches for a child element in the present scrollable container that matches the selector you provided. /// The search is performed without scrolling and only on visible elements. /// Maps to: UiScrollable.getChildByInstance (UiSelector childPattern, int instance) method (see remarks). /// </summary> /// <param name="selector"> UiSelector for a child in a scollable layout element </param> /// <param name="instance"> number representing the occurance of a childPattern match </param> /// <remarks>https://developer.android.com/reference/androidx/test/uiautomator/UiScrollable#getChildByInstance(androidx.test.uiautomator.UiSelector,%20int)</remarks> private void GetChildByInstance(Selector selector, int instance) { _stringBuilder.Append(".getChildByInstance("); _stringBuilder.Append(MiscUiAutomator.ReBuildString(selector)); _stringBuilder.Append(", "); _stringBuilder.Append(instance.ToString()); _stringBuilder.Append(")"); }
/// <summary> /// Searches for a child element in the present scrollable container. The search first looks for a child element that matches the /// selector you provided, then looks for the text in its children elements. If both search conditions are fulfilled, the method /// returns a {@ link UiObject} representing the element matching the selector (not the child element in its sub-hierarchy containing the text). /// Maps to: UiScrollable.getChildByText (UiSelector childPattern, String text, boolean allowScrollSearch) method (see remarks). /// </summary> /// <param name="selector"> UiSelector for a child in a scollable layout element </param> /// <param name="text"> text to find in the children of the childPattern match </param> /// <param name="allowScrollSearch"> Set to true if scrolling is allowed </param> /// <remarks>https://developer.android.com/reference/androidx/test/uiautomator/UiScrollable#getChildByInstance(androidx.test.uiautomator.UiSelector,%20int)</remarks> private void GetChildByText(Selector selector, string text, bool allowScrollSearch = true) { _stringBuilder.Append(".getChildByText("); _stringBuilder.Append(MiscUiAutomator.ReBuildString(selector)); _stringBuilder.Append(", \""); _stringBuilder.Append(text); _stringBuilder.Append("\", "); _stringBuilder.Append(allowScrollSearch.ToString().ToLowerInvariant()); _stringBuilder.Append(")"); }