示例#1
0
 /// <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 content-description 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 subhierarchy containing
 /// the content-description). By default, this method performs a scroll search.
 /// Maps to the UiScrollable.getChildByDescription(UiSelector, String, boolean) method.
 /// </summary>
 /// <param name="uiSelector">
 /// UiSelector for a child in a scollable layout element
 /// </param>
 /// <param name="description">
 /// Content-description to find in the children of the childPattern match (may be a partial match)
 /// </param>
 /// <param name="allowScrollSearch">
 /// Set to true if scrolling is allowed
 /// </param>
 /// <remarks>https://developer.android.com/reference/android/support/test/uiautomator/UiScrollable#getchildbydescription_1</remarks>
 public TerminatedStatementBuilder GetChildByDescription(AndroidUiSelector uiSelector, string description, bool allowScrollSearch = true)
 {
     return(AppendTerminalStatement(".getChildByDescription({0}, \"{1}\", {2})",
                                    uiSelector.RequireNotNull(nameof(uiSelector)).Build(),
                                    description.RequireNotNull(nameof(description)),
                                    allowScrollSearch.ToString().ToLowerInvariant()));
 }
 /// <summary>
 /// Adds a child UiSelector criteria to this selector. Use this selector to narrow the search scope to child
 /// widgets under a specific parent widget.
 /// Maps to the UiSelector.childSelector(UiSelector) method.
 /// </summary>
 /// <param name="selector"></param>
 /// <remarks>https://developer.android.com/reference/androidx/test/uiautomator/UiSelector#childselector</remarks>
 public AndroidUiSelector ChildSelector(AndroidUiSelector selector)
 {
     _builder.AppendFormat(".childSelector({0})", selector.RequireNotNull(nameof(selector)).Build());
     return(this);
 }
 /// <summary>
 /// Creates a new UiSelector builder by copying all existing data
 /// from the given selector.
 /// </summary>
 /// <param name="selector">
 /// The <see cref="AndroidUiSelector"/> to copy into this new instance
 /// </param>
 public AndroidUiSelector(AndroidUiSelector selector)
 {
     _builder = new StringBuilder(selector.RequireNotNull(nameof(selector)).Build());
 }
 /// <summary>
 /// Adds a child UiSelector criteria to this selector which is used to start search from the parent widget.
 /// Use this selector to narrow the search scope to sibling widgets as well all child widgets under a parent.
 /// Maps to the UiSelector.fromParent(UiSelector) method.
 /// </summary>
 /// <param name="selector"></param>
 /// <remarks>https://developer.android.com/reference/androidx/test/uiautomator/UiSelector#fromparent</remarks>
 public AndroidUiSelector FromParent(AndroidUiSelector selector)
 {
     _builder.AppendFormat(".fromParent({0})", selector.RequireNotNull(nameof(selector)).Build());
     return(this);
 }
示例#5
0
 /// <summary>
 /// Creates a new scrollable searcher which will match the first widget
 /// which matches the given UISelector.
 /// </summary>
 /// <param name="uiSelector">
 /// A UiSelector that will be used to find the scrollable container
 /// </param>
 public AndroidUiScrollable(AndroidUiSelector uiSelector)
 {
     _builder = new StringBuilder().AppendFormat("new UiScrollable({0})",
                                                 uiSelector.RequireNotNull(nameof(uiSelector)).Build());
 }
示例#6
0
 /// <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 the UiScrollable.scrollIntoView(UiSelector) method.
 /// </summary>
 /// <param name="uiSelector"></param>
 /// <remarks>https://developer.android.com/reference/android/support/test/uiautomator/UiScrollable#scrollintoview</remarks>
 public TerminatedStatementBuilder ScrollIntoView(AndroidUiSelector uiSelector)
 {
     return(AppendTerminalStatement(".scrollIntoView({0})",
                                    uiSelector.RequireNotNull(nameof(uiSelector)).Build()));
 }
示例#7
0
 /// <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 the UiScrollable.getChildByInstance(UiSelector, int) method.
 /// </summary>
 /// <param name="uiSelector"></param>
 /// <param name="instance"></param>
 /// <remarks>https://developer.android.com/reference/android/support/test/uiautomator/UiScrollable#getchildbyinstance</remarks>
 public TerminatedStatementBuilder GetChildByInstance(AndroidUiSelector uiSelector, int instance)
 {
     return(AppendTerminalStatement(".getChildByInstance({0}, {1})",
                                    uiSelector.RequireNotNull(nameof(uiSelector)).Build(),
                                    instance.RequireIsPositive(nameof(instance))));
 }