blob: 70845402bb6d8cdb622af560ff8aa62f8e652a20 [file] [log] [blame]
page.title=UiSelector
parent.title=uiautomator
parent.link=index.html
@jd:body
<style>
h4.jd-details-title {background-color: #DEE8F1;}
</style>
<p>Specifies the elements in the layout hierarchy for tests to target, filtered
by properties such as text value, content-description, class name, and state
information. You can also target an element by its location in a layout
hierarchy.</p>
<h2>Summary</h2>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<table id="pubctors" class="jd-sumtable"><tr><th colspan="12">Public Constructors</th></tr>
<tr class="api" >
<td class="jd-typecol"><nobr>
</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="#UiSelector()">UiSelector</a></span>()</nobr>
</td></tr>
</table>
<!-- ========== METHOD SUMMARY =========== -->
<table id="pubmethods" class="jd-sumtable"><tr><th colspan="12">Public Methods</th></tr>
<tr class="api" >
<td class="jd-typecol"><nobr>
<a href="#">UiSelector</a></nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="#checkable(boolean)">checkable</a></span>(boolean val)</nobr>
<div class="jd-descrdiv">Set the search criteria to match widgets that are checkable.</div>
</td></tr>
<tr class="api" >
<td class="jd-typecol"><nobr>
<a href="#">UiSelector</a></nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="#checked(boolean)">checked</a></span>(boolean val)</nobr>
<div class="jd-descrdiv">Set the search criteria to match widgets that
are currently checked (usually for checkboxes).</div>
</td></tr>
<tr class="api" >
<td class="jd-typecol"><nobr>
<a href="#">UiSelector</a></nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="#childSelector(com.android.uiautomator.core.UiSelector)">childSelector</a></span>(<a href="#">UiSelector</a> selector)</nobr>
<div class="jd-descrdiv">Adds a child UiSelector criteria to this selector.</div>
</td></tr>
<tr class="api" >
<td class="jd-typecol"><nobr>
<a href="#">UiSelector</a></nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="#className(java.lang.String)">className</a></span>(String className)</nobr>
<div class="jd-descrdiv">Set the search criteria to match the class property
for a widget (for example, "android.widget.Button").</div>
</td></tr>
<tr class="api" >
<td class="jd-typecol"><nobr>
&lt;T&gt;
<a href="#">UiSelector</a></nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="#className(java.lang.Class<T>)">className</a></span>(Class&lt;T&gt; type)</nobr>
<div class="jd-descrdiv">Set the search criteria to match the class property
for a widget (for example, "android.widget.Button").</div>
</td></tr>
<tr class="api" >
<td class="jd-typecol"><nobr>
<a href="#">UiSelector</a></nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="#classNameMatches(java.lang.String)">classNameMatches</a></span>(String regex)</nobr>
<div class="jd-descrdiv">Set the search criteria to match the class property
for a widget, using a regular expression.</div>
</td></tr>
<tr class="api" >
<td class="jd-typecol"><nobr>
<a href="#">UiSelector</a></nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="#clickable(boolean)">clickable</a></span>(boolean val)</nobr>
<div class="jd-descrdiv">Set the search criteria to match widgets that are clickable.</div>
</td></tr>
<tr class="api" >
<td class="jd-typecol"><nobr>
<a href="#">UiSelector</a></nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="#description(java.lang.String)">description</a></span>(String desc)</nobr>
<div class="jd-descrdiv">Set the search criteria to match the content-description
property for a widget.</div>
</td></tr>
<tr class="api" >
<td class="jd-typecol"><nobr>
<a href="#">UiSelector</a></nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="#descriptionContains(java.lang.String)">descriptionContains</a></span>(String desc)</nobr>
<div class="jd-descrdiv">Set the search criteria to match the content-description
property for a widget.</div>
</td></tr>
<tr class="api" >
<td class="jd-typecol"><nobr>
<a href="#">UiSelector</a></nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="#descriptionMatches(java.lang.String)">descriptionMatches</a></span>(String regex)</nobr>
<div class="jd-descrdiv">Set the search criteria to match the content-description
property for a widget.</div>
</td></tr>
<tr class="api" >
<td class="jd-typecol"><nobr>
<a href="#">UiSelector</a></nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="#descriptionStartsWith(java.lang.String)">descriptionStartsWith</a></span>(String desc)</nobr>
<div class="jd-descrdiv">Set the search criteria to match the content-description
property for a widget.</div>
</td></tr>
<tr class="api" >
<td class="jd-typecol"><nobr>
<a href="#">UiSelector</a></nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="#enabled(boolean)">enabled</a></span>(boolean val)</nobr>
<div class="jd-descrdiv">Set the search criteria to match widgets that are enabled.</div>
</td></tr>
<tr class="api" >
<td class="jd-typecol"><nobr>
<a href="#">UiSelector</a></nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="#focusable(boolean)">focusable</a></span>(boolean val)</nobr>
<div class="jd-descrdiv">Set the search criteria to match widgets that are focusable.</div>
</td></tr>
<tr class="api" >
<td class="jd-typecol"><nobr>
<a href="#">UiSelector</a></nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="#focused(boolean)">focused</a></span>(boolean val)</nobr>
<div class="jd-descrdiv">Set the search criteria to match widgets that have focus.</div>
</td></tr>
<tr class="api" >
<td class="jd-typecol"><nobr>
<a href="#">UiSelector</a></nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="#fromParent(com.android.uiautomator.core.UiSelector)">fromParent</a></span>(<a href="#">UiSelector</a> selector)</nobr>
<div class="jd-descrdiv">Adds a child UiSelector criteria to this selector which is used to
start search from the parent widget.</div>
</td></tr>
<tr class="api" >
<td class="jd-typecol"><nobr>
<a href="#">UiSelector</a></nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="#index(int)">index</a></span>(int index)</nobr>
<div class="jd-descrdiv">Set the search criteria to match the widget by its node
index in the layout hierarchy.</div>
</td></tr>
<tr class="api" >
<td class="jd-typecol"><nobr>
<a href="#">UiSelector</a></nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="#instance(int)">instance</a></span>(int instance)</nobr>
<div class="jd-descrdiv">Set the search criteria to match the
widget by its instance number.</div>
</td></tr>
<tr class="api" >
<td class="jd-typecol"><nobr>
<a href="#">UiSelector</a></nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="#longClickable(boolean)">longClickable</a></span>(boolean val)</nobr>
<div class="jd-descrdiv">Set the search criteria to match widgets that are long-clickable.</div>
</td></tr>
<tr class="api" >
<td class="jd-typecol"><nobr>
<a href="#">UiSelector</a></nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="#packageName(java.lang.String)">packageName</a></span>(String name)</nobr>
<div class="jd-descrdiv">Set the search criteria to match the package name
of the application that contains the widget.</div>
</td></tr>
<tr class="api" >
<td class="jd-typecol"><nobr>
<a href="#">UiSelector</a></nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="#packageNameMatches(java.lang.String)">packageNameMatches</a></span>(String regex)</nobr>
<div class="jd-descrdiv">Set the search criteria to match the package name
of the application that contains the widget.</div>
</td></tr>
<tr class="api" >
<td class="jd-typecol"><nobr>
<a href="#">UiSelector</a></nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="#resourceId(java.lang.String)">resourceId</a></span>(String id)</nobr>
<div class="jd-descrdiv">Set the search criteria to match the given resource ID.</div>
</td></tr>
<tr class="api" >
<td class="jd-typecol"><nobr>
<a href="#">UiSelector</a></nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="#resourceIdMatches(java.lang.String)">resourceIdMatches</a></span>(String regex)</nobr>
<div class="jd-descrdiv">Set the search criteria to match the resource ID
of the widget, using a regular expression.</div>
</td></tr>
<tr class="api" >
<td class="jd-typecol"><nobr>
<a href="#">UiSelector</a></nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="#scrollable(boolean)">scrollable</a></span>(boolean val)</nobr>
<div class="jd-descrdiv">Set the search criteria to match widgets that are scrollable.</div>
</td></tr>
<tr class="api" >
<td class="jd-typecol"><nobr>
<a href="#">UiSelector</a></nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="#selected(boolean)">selected</a></span>(boolean val)</nobr>
<div class="jd-descrdiv">Set the search criteria to match widgets that
are currently selected.</div>
</td></tr>
<tr class="api" >
<td class="jd-typecol"><nobr>
<a href="#">UiSelector</a></nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="#text(java.lang.String)">text</a></span>(String text)</nobr>
<div class="jd-descrdiv">Set the search criteria to match the visible text displayed
in a widget (for example, the text label to launch an app).</div>
</td></tr>
<tr class="api" >
<td class="jd-typecol"><nobr>
<a href="#">UiSelector</a></nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="#textContains(java.lang.String)">textContains</a></span>(String text)</nobr>
<div class="jd-descrdiv">Set the search criteria to match the visible text in a widget
where the visible text must contain the string in your input argument.</div>
</td></tr>
<tr class="api" >
<td class="jd-typecol"><nobr>
<a href="#">UiSelector</a></nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="#textMatches(java.lang.String)">textMatches</a></span>(String regex)</nobr>
<div class="jd-descrdiv">Set the search criteria to match the visible text displayed in a layout
element, using a regular expression.</div>
</td></tr>
<tr class="api" >
<td class="jd-typecol"><nobr>
<a href="#">UiSelector</a></nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="#textStartsWith(java.lang.String)">textStartsWith</a></span>(String text)</nobr>
<div class="jd-descrdiv">Set the search criteria to match visible text in a widget that is
prefixed by the text parameter.</div>
</td></tr>
<tr class="api" >
<td class="jd-typecol"><nobr>
String</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="#toString()">toString</a></span>()</nobr>
</td></tr>
</table>
<!-- ========== METHOD SUMMARY =========== -->
<table id="promethods" class="jd-sumtable"><tr><th colspan="12">Protected Methods</th></tr>
<tr class="api" >
<td class="jd-typecol"><nobr>
<a href="#">UiSelector</a></nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="#cloneSelector()">cloneSelector</a></span>()</nobr>
</td></tr>
</table>
<!-- ========== METHOD SUMMARY =========== -->
<table id="inhmethods" class="jd-sumtable"><tr><th>
<a href="#" class="toggle-all" onclick="return toggleAllInherited(this, null)">[Expand]</a>
<div style="clear:left;">Inherited Methods</div></th></tr>
<tr class="api" >
<td colspan="12">
<a href="#" onclick="return toggleInherited(this, null)" id="inherited-methods-java.lang.Object" class="jd-expando-trigger closed"
><img id="inherited-methods-java.lang.Object-trigger"
src="../../../../../assets/images/triangle-closed.png"
class="jd-expando-trigger-img" /></a>
From class
java.lang.Object
<div id="inherited-methods-java.lang.Object">
<div id="inherited-methods-java.lang.Object-list"
class="jd-inheritedlinks">
</div>
<div id="inherited-methods-java.lang.Object-summary" style="display: none;">
<table class="jd-sumtable-expando">
<tr class="api" >
<td class="jd-typecol"><nobr>
Object</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad">clone</span>()</nobr>
</td></tr>
<tr class="api" >
<td class="jd-typecol"><nobr>
boolean</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad">equals</span>(Object arg0)</nobr>
</td></tr>
<tr class="api" >
<td class="jd-typecol"><nobr>
void</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad">finalize</span>()</nobr>
</td></tr>
<tr class="api" >
<td class="jd-typecol"><nobr>
final
Class&lt;?&gt;</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad">getClass</span>()</nobr>
</td></tr>
<tr class="api" >
<td class="jd-typecol"><nobr>
int</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad">hashCode</span>()</nobr>
</td></tr>
<tr class="api" >
<td class="jd-typecol"><nobr>
final
void</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad">notify</span>()</nobr>
</td></tr>
<tr class="api" >
<td class="jd-typecol"><nobr>
final
void</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad">notifyAll</span>()</nobr>
</td></tr>
<tr class="api" >
<td class="jd-typecol"><nobr>
String</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad">toString</span>()</nobr>
</td></tr>
<tr class="api" >
<td class="jd-typecol"><nobr>
final
void</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad">wait</span>()</nobr>
</td></tr>
<tr class="api" >
<td class="jd-typecol"><nobr>
final
void</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad">wait</span>(long arg0, int arg1)</nobr>
</td></tr>
<tr class="api" >
<td class="jd-typecol"><nobr>
final
void</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad">wait</span>(long arg0)</nobr>
</td></tr>
</table>
</div>
</div>
</td></tr>
</table>
</div><!-- jd-descr (summary) -->
<!-- Details -->
<!-- XML Attributes -->
<!-- Enum Values -->
<!-- Constants -->
<!-- Fields -->
<!-- Public ctors -->
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<h2>Public Constructors</h2>
<A NAME="UiSelector()"></A>
<div class="jd-details api">
<h4 class="jd-details-title">
<span class="normal">
public
</span>
<span class="sympad">UiSelector</span>
<span class="normal">()</span>
</h4>
<div class="api-level">
<div></div>
</div>
<div class="jd-details-descr">
<div class="jd-tagdata jd-tagdescr"><p></p></div>
</div>
</div>
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<!-- Protected ctors -->
<!-- ========= METHOD DETAIL ======== -->
<!-- Public methdos -->
<h2>Public Methods</h2>
<A NAME="checkable(boolean)"></A>
<div class="jd-details api">
<h4 class="jd-details-title">
<span class="normal">
public
<a href="#">UiSelector</a>
</span>
<span class="sympad">checkable</span>
<span class="normal">(boolean val)</span>
</h4>
<div class="jd-details-descr">
<div class="jd-tagdata jd-tagdescr"><p>Set the search criteria to match widgets that are checkable.
Typically, using this search criteria alone is not useful.
You should also include additional criteria, such as text,
content-description, or the class name for a widget.
If no other search criteria is specified, and there is more
than one matching widget, the first widget in the tree
is selected.</p></div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Parameters</h5>
<table class="jd-tagtable">
<tr>
<th>val</td>
<td>Value to match</td>
</tr>
</table>
</div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Returns</h5>
<ul class="nolist"><li>UiSelector with the specified search criteria</li></ul>
</div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Since</h5>
<ul class="nolist"><li>Android API Level 18</li></ul>
</div>
</div>
</div>
<A NAME="checked(boolean)"></A>
<div class="jd-details api">
<h4 class="jd-details-title">
<span class="normal">
public
<a href="#">UiSelector</a>
</span>
<span class="sympad">checked</span>
<span class="normal">(boolean val)</span>
</h4>
<div class="api-level">
<div></div>
</div>
<div class="jd-details-descr">
<div class="jd-tagdata jd-tagdescr"><p>Set the search criteria to match widgets that
are currently checked (usually for checkboxes).
Typically, using this search criteria alone is not useful.
You should also include additional criteria, such as text,
content-description, or the class name for a widget.
If no other search criteria is specified, and there is more
than one matching widget, the first widget in the tree
is selected.</p></div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Parameters</h5>
<table class="jd-tagtable">
<tr>
<th>val</td>
<td>Value to match</td>
</tr>
</table>
</div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Returns</h5>
<ul class="nolist"><li>UiSelector with the specified search criteria</li></ul>
</div>
</div>
</div>
<A NAME="childSelector(com.android.uiautomator.core.UiSelector)"></A>
<div class="jd-details api">
<h4 class="jd-details-title">
<span class="normal">
public
<a href="#">UiSelector</a>
</span>
<span class="sympad">childSelector</span>
<span class="normal">(<a href="#">UiSelector</a> selector)</span>
</h4>
<div class="api-level">
<div></div>
</div>
<div class="jd-details-descr">
<div class="jd-tagdata jd-tagdescr"><p>Adds a child UiSelector criteria to this selector.
Use this selector to narrow the search scope to
child widgets under a specific parent widget.</p></div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Returns</h5>
<ul class="nolist"><li>UiSelector with this added search criterion</li></ul>
</div>
</div>
</div>
<A NAME="className(java.lang.String)"></A>
<div class="jd-details api">
<h4 class="jd-details-title">
<span class="normal">
public
<a href="#">UiSelector</a>
</span>
<span class="sympad">className</span>
<span class="normal">(String className)</span>
</h4>
<div class="jd-details-descr">
<div class="jd-tagdata jd-tagdescr"><p>Set the search criteria to match the class property
for a widget (for example, "android.widget.Button").</p></div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Parameters</h5>
<table class="jd-tagtable">
<tr>
<th>className</td>
<td>Value to match</td>
</tr>
</table>
</div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Returns</h5>
<ul class="nolist"><li>UiSelector with the specified search criteria</li></ul>
</div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Since</h5>
<ul class="nolist"><li>Android API Level 17</li></ul>
</div>
</div>
</div>
<A NAME="className(java.lang.Class<T>)"></A>
<div class="jd-details api">
<h4 class="jd-details-title">
<span class="normal">
public
<a href="#">UiSelector</a>
</span>
<span class="sympad">className</span>
<span class="normal">(Class&lt;T&gt; type)</span>
</h4>
<div class="api-level">
<div></div>
</div>
<div class="jd-details-descr">
<div class="jd-tagdata jd-tagdescr"><p>Set the search criteria to match the class property
for a widget (for example, "android.widget.Button").</p></div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Parameters</h5>
<table class="jd-tagtable">
<tr>
<th>type</td>
<td>type</td>
</tr>
</table>
</div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Returns</h5>
<ul class="nolist"><li>UiSelector with the specified search criteria</li></ul>
</div>
</div>
</div>
<A NAME="classNameMatches(java.lang.String)"></A>
<div class="jd-details api">
<h4 class="jd-details-title">
<span class="normal">
public
<a href="#">UiSelector</a>
</span>
<span class="sympad">classNameMatches</span>
<span class="normal">(String regex)</span>
</h4>
<div class="jd-details-descr">
<div class="jd-tagdata jd-tagdescr"><p>Set the search criteria to match the class property
for a widget, using a regular expression.</p></div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Parameters</h5>
<table class="jd-tagtable">
<tr>
<th>regex</td>
<td>a regular expression</td>
</tr>
</table>
</div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Returns</h5>
<ul class="nolist"><li>UiSelector with the specified search criteria</li></ul>
</div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Since</h5>
<ul class="nolist"><li>Android API Level 17</li></ul>
</div>
</div>
</div>
<A NAME="clickable(boolean)"></A>
<div class="jd-details api">
<h4 class="jd-details-title">
<span class="normal">
public
<a href="#">UiSelector</a>
</span>
<span class="sympad">clickable</span>
<span class="normal">(boolean val)</span>
</h4>
<div class="api-level">
<div></div>
</div>
<div class="jd-details-descr">
<div class="jd-tagdata jd-tagdescr"><p>Set the search criteria to match widgets that are clickable.
Typically, using this search criteria alone is not useful.
You should also include additional criteria, such as text,
content-description, or the class name for a widget.
If no other search criteria is specified, and there is more
than one matching widget, the first widget in the tree
is selected.</p></div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Parameters</h5>
<table class="jd-tagtable">
<tr>
<th>val</td>
<td>Value to match</td>
</tr>
</table>
</div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Returns</h5>
<ul class="nolist"><li>UiSelector with the specified search criteria</li></ul>
</div>
</div>
</div>
<A NAME="description(java.lang.String)"></A>
<div class="jd-details api">
<h4 class="jd-details-title">
<span class="normal">
public
<a href="#">UiSelector</a>
</span>
<span class="sympad">description</span>
<span class="normal">(String desc)</span>
</h4>
<div class="api-level">
<div></div>
</div>
<div class="jd-details-descr">
<div class="jd-tagdata jd-tagdescr"><p>Set the search criteria to match the content-description
property for a widget.
The content-description is typically used
by the Android Accessibility framework to
provide an audio prompt for the widget when
the widget is selected. The content-description
for the widget must match exactly
with the string in your input argument.
Matching is case-sensitive.</p></div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Parameters</h5>
<table class="jd-tagtable">
<tr>
<th>desc</td>
<td>Value to match</td>
</tr>
</table>
</div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Returns</h5>
<ul class="nolist"><li>UiSelector with the specified search criteria</li></ul>
</div>
</div>
</div>
<A NAME="descriptionContains(java.lang.String)"></A>
<div class="jd-details api">
<h4 class="jd-details-title">
<span class="normal">
public
<a href="#">UiSelector</a>
</span>
<span class="sympad">descriptionContains</span>
<span class="normal">(String desc)</span>
</h4>
<div class="api-level">
<div></div>
</div>
<div class="jd-details-descr">
<div class="jd-tagdata jd-tagdescr"><p>Set the search criteria to match the content-description
property for a widget.
The content-description is typically used
by the Android Accessibility framework to
provide an audio prompt for the widget when
the widget is selected. The content-description
for the widget must contain
the string in your input argument.
Matching is case-insensitive.</p></div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Parameters</h5>
<table class="jd-tagtable">
<tr>
<th>desc</td>
<td>Value to match</td>
</tr>
</table>
</div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Returns</h5>
<ul class="nolist"><li>UiSelector with the specified search criteria</li></ul>
</div>
</div>
</div>
<A NAME="descriptionMatches(java.lang.String)"></A>
<div class="jd-details api">
<h4 class="jd-details-title">
<span class="normal">
public
<a href="#">UiSelector</a>
</span>
<span class="sympad">descriptionMatches</span>
<span class="normal">(String regex)</span>
</h4>
<div class="jd-details-descr">
<div class="jd-tagdata jd-tagdescr"><p>Set the search criteria to match the content-description
property for a widget.
The content-description is typically used
by the Android Accessibility framework to
provide an audio prompt for the widget when
the widget is selected. The content-description
for the widget must match exactly
with the string in your input argument.</p></div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Parameters</h5>
<table class="jd-tagtable">
<tr>
<th>regex</td>
<td>a regular expression</td>
</tr>
</table>
</div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Returns</h5>
<ul class="nolist"><li>UiSelector with the specified search criteria</li></ul>
</div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Since</h5>
<ul class="nolist"><li>Android API Level 17</li></ul>
</div>
</div>
</div>
<A NAME="descriptionStartsWith(java.lang.String)"></A>
<div class="jd-details api">
<h4 class="jd-details-title">
<span class="normal">
public
<a href="#">UiSelector</a>
</span>
<span class="sympad">descriptionStartsWith</span>
<span class="normal">(String desc)</span>
</h4>
<div class="api-level">
<div></div>
</div>
<div class="jd-details-descr">
<div class="jd-tagdata jd-tagdescr"><p>Set the search criteria to match the content-description
property for a widget.
The content-description is typically used
by the Android Accessibility framework to
provide an audio prompt for the widget when
the widget is selected. The content-description
for the widget must start
with the string in your input argument.
Matching is case-insensitive.</p></div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Parameters</h5>
<table class="jd-tagtable">
<tr>
<th>desc</td>
<td>Value to match</td>
</tr>
</table>
</div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Returns</h5>
<ul class="nolist"><li>UiSelector with the specified search criteria</li></ul>
</div>
</div>
</div>
<A NAME="enabled(boolean)"></A>
<div class="jd-details api">
<h4 class="jd-details-title">
<span class="normal">
public
<a href="#">UiSelector</a>
</span>
<span class="sympad">enabled</span>
<span class="normal">(boolean val)</span>
</h4>
<div class="api-level">
<div></div>
</div>
<div class="jd-details-descr">
<div class="jd-tagdata jd-tagdescr"><p>Set the search criteria to match widgets that are enabled.
Typically, using this search criteria alone is not useful.
You should also include additional criteria, such as text,
content-description, or the class name for a widget.
If no other search criteria is specified, and there is more
than one matching widget, the first widget in the tree
is selected.</p></div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Parameters</h5>
<table class="jd-tagtable">
<tr>
<th>val</td>
<td>Value to match</td>
</tr>
</table>
</div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Returns</h5>
<ul class="nolist"><li>UiSelector with the specified search criteria</li></ul>
</div>
</div>
</div>
<A NAME="focusable(boolean)"></A>
<div class="jd-details api">
<h4 class="jd-details-title">
<span class="normal">
public
<a href="#">UiSelector</a>
</span>
<span class="sympad">focusable</span>
<span class="normal">(boolean val)</span>
</h4>
<div class="api-level">
<div></div>
</div>
<div class="jd-details-descr">
<div class="jd-tagdata jd-tagdescr"><p>Set the search criteria to match widgets that are focusable.
Typically, using this search criteria alone is not useful.
You should also include additional criteria, such as text,
content-description, or the class name for a widget.
If no other search criteria is specified, and there is more
than one matching widget, the first widget in the tree
is selected.</p></div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Parameters</h5>
<table class="jd-tagtable">
<tr>
<th>val</td>
<td>Value to match</td>
</tr>
</table>
</div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Returns</h5>
<ul class="nolist"><li>UiSelector with the specified search criteria</li></ul>
</div>
</div>
</div>
<A NAME="focused(boolean)"></A>
<div class="jd-details api">
<h4 class="jd-details-title">
<span class="normal">
public
<a href="#">UiSelector</a>
</span>
<span class="sympad">focused</span>
<span class="normal">(boolean val)</span>
</h4>
<div class="api-level">
<div></div>
</div>
<div class="jd-details-descr">
<div class="jd-tagdata jd-tagdescr"><p>Set the search criteria to match widgets that have focus.
Typically, using this search criteria alone is not useful.
You should also include additional criteria, such as text,
content-description, or the class name for a widget.
If no other search criteria is specified, and there is more
than one matching widget, the first widget in the tree
is selected.</p></div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Parameters</h5>
<table class="jd-tagtable">
<tr>
<th>val</td>
<td>Value to match</td>
</tr>
</table>
</div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Returns</h5>
<ul class="nolist"><li>UiSelector with the specified search criteria</li></ul>
</div>
</div>
</div>
<A NAME="fromParent(com.android.uiautomator.core.UiSelector)"></A>
<div class="jd-details api">
<h4 class="jd-details-title">
<span class="normal">
public
<a href="#">UiSelector</a>
</span>
<span class="sympad">fromParent</span>
<span class="normal">(<a href="#">UiSelector</a> selector)</span>
</h4>
<div class="api-level">
<div></div>
</div>
<div class="jd-details-descr">
<div class="jd-tagdata jd-tagdescr"><p>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.</p></div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Returns</h5>
<ul class="nolist"><li>UiSelector with this added search criterion</li></ul>
</div>
</div>
</div>
<A NAME="index(int)"></A>
<div class="jd-details api">
<h4 class="jd-details-title">
<span class="normal">
public
<a href="#">UiSelector</a>
</span>
<span class="sympad">index</span>
<span class="normal">(int index)</span>
</h4>
<div class="api-level">
<div></div>
</div>
<div class="jd-details-descr">
<div class="jd-tagdata jd-tagdescr"><p>Set the search criteria to match the widget by its node
index in the layout hierarchy.
The index value must be 0 or greater.
Using the index can be unreliable and should only
be used as a last resort for matching. Instead,
consider using the <code><a href="#instance(int)">instance(int)</a></code> method.</p></div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Parameters</h5>
<table class="jd-tagtable">
<tr>
<th>index</td>
<td>Value to match</td>
</tr>
</table>
</div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Returns</h5>
<ul class="nolist"><li>UiSelector with the specified search criteria</li></ul>
</div>
</div>
</div>
<A NAME="instance(int)"></A>
<div class="jd-details api">
<h4 class="jd-details-title">
<span class="normal">
public
<a href="#">UiSelector</a>
</span>
<span class="sympad">instance</span>
<span class="normal">(int instance)</span>
</h4>
<div class="api-level">
<div></div>
</div>
<div class="jd-details-descr">
<div class="jd-tagdata jd-tagdescr"><p>Set the search criteria to match the
widget by its instance number.
The instance value must be 0 or greater, where
the first instance is 0.
For example, to simulate a user click on
the third image that is enabled in a UI screen, you
could specify a a search criteria where the instance is
2, the <code><a href="#className(java.lang.String)">className(String)</a></code> matches the image
widget class, and <code><a href="#enabled(boolean)">enabled(boolean)</a></code> is true.
The code would look like this:
<code>
new UiSelector().className("android.widget.ImageView")
.enabled(true).instance(2);
</code></p></div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Parameters</h5>
<table class="jd-tagtable">
<tr>
<th>instance</td>
<td>Value to match</td>
</tr>
</table>
</div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Returns</h5>
<ul class="nolist"><li>UiSelector with the specified search criteria</li></ul>
</div>
</div>
</div>
<A NAME="longClickable(boolean)"></A>
<div class="jd-details api">
<h4 class="jd-details-title">
<span class="normal">
public
<a href="#">UiSelector</a>
</span>
<span class="sympad">longClickable</span>
<span class="normal">(boolean val)</span>
</h4>
<div class="jd-details-descr">
<div class="jd-tagdata jd-tagdescr"><p>Set the search criteria to match widgets that are long-clickable.
Typically, using this search criteria alone is not useful.
You should also include additional criteria, such as text,
content-description, or the class name for a widget.
If no other search criteria is specified, and there is more
than one matching widget, the first widget in the tree
is selected.</p></div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Parameters</h5>
<table class="jd-tagtable">
<tr>
<th>val</td>
<td>Value to match</td>
</tr>
</table>
</div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Returns</h5>
<ul class="nolist"><li>UiSelector with the specified search criteria</li></ul>
</div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Since</h5>
<ul class="nolist"><li>Android API Level 17</li></ul>
</div>
</div>
</div>
<A NAME="packageName(java.lang.String)"></A>
<div class="jd-details api">
<h4 class="jd-details-title">
<span class="normal">
public
<a href="#">UiSelector</a>
</span>
<span class="sympad">packageName</span>
<span class="normal">(String name)</span>
</h4>
<div class="api-level">
<div></div>
</div>
<div class="jd-details-descr">
<div class="jd-tagdata jd-tagdescr"><p>Set the search criteria to match the package name
of the application that contains the widget.</p></div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Parameters</h5>
<table class="jd-tagtable">
<tr>
<th>name</td>
<td>Value to match</td>
</tr>
</table>
</div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Returns</h5>
<ul class="nolist"><li>UiSelector with the specified search criteria</li></ul>
</div>
</div>
</div>
<A NAME="packageNameMatches(java.lang.String)"></A>
<div class="jd-details api">
<h4 class="jd-details-title">
<span class="normal">
public
<a href="#">UiSelector</a>
</span>
<span class="sympad">packageNameMatches</span>
<span class="normal">(String regex)</span>
</h4>
<div class="jd-details-descr">
<div class="jd-tagdata jd-tagdescr"><p>Set the search criteria to match the package name
of the application that contains the widget.</p></div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Parameters</h5>
<table class="jd-tagtable">
<tr>
<th>regex</td>
<td>a regular expression</td>
</tr>
</table>
</div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Returns</h5>
<ul class="nolist"><li>UiSelector with the specified search criteria</li></ul>
</div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Since</h5>
<ul class="nolist"><li>Android API Level 17</li></ul>
</div>
</div>
</div>
<A NAME="resourceId(java.lang.String)"></A>
<div class="jd-details api">
<h4 class="jd-details-title">
<span class="normal">
public
<a href="#">UiSelector</a>
</span>
<span class="sympad">resourceId</span>
<span class="normal">(String id)</span>
</h4>
<div class="jd-details-descr">
<div class="jd-tagdata jd-tagdescr"><p>Set the search criteria to match the given resource ID.</p></div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Parameters</h5>
<table class="jd-tagtable">
<tr>
<th>id</td>
<td>Value to match</td>
</tr>
</table>
</div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Returns</h5>
<ul class="nolist"><li>UiSelector with the specified search criteria</li></ul>
</div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Since</h5>
<ul class="nolist"><li>Android API Level 18</li></ul>
</div>
</div>
</div>
<A NAME="resourceIdMatches(java.lang.String)"></A>
<div class="jd-details api">
<h4 class="jd-details-title">
<span class="normal">
public
<a href="#">UiSelector</a>
</span>
<span class="sympad">resourceIdMatches</span>
<span class="normal">(String regex)</span>
</h4>
<div class="jd-details-descr">
<div class="jd-tagdata jd-tagdescr"><p>Set the search criteria to match the resource ID
of the widget, using a regular expression.</p></div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Parameters</h5>
<table class="jd-tagtable">
<tr>
<th>regex</td>
<td>a regular expression</td>
</tr>
</table>
</div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Returns</h5>
<ul class="nolist"><li>UiSelector with the specified search criteria</li></ul>
</div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Since</h5>
<ul class="nolist"><li>Android API Level 18</li></ul>
</div>
</div>
</div>
<A NAME="scrollable(boolean)"></A>
<div class="jd-details api">
<h4 class="jd-details-title">
<span class="normal">
public
<a href="#">UiSelector</a>
</span>
<span class="sympad">scrollable</span>
<span class="normal">(boolean val)</span>
</h4>
<div class="api-level">
<div></div>
</div>
<div class="jd-details-descr">
<div class="jd-tagdata jd-tagdescr"><p>Set the search criteria to match widgets that are scrollable.
Typically, using this search criteria alone is not useful.
You should also include additional criteria, such as text,
content-description, or the class name for a widget.
If no other search criteria is specified, and there is more
than one matching widget, the first widget in the tree
is selected.</p></div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Parameters</h5>
<table class="jd-tagtable">
<tr>
<th>val</td>
<td>Value to match</td>
</tr>
</table>
</div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Returns</h5>
<ul class="nolist"><li>UiSelector with the specified search criteria</li></ul>
</div>
</div>
</div>
<A NAME="selected(boolean)"></A>
<div class="jd-details api">
<h4 class="jd-details-title">
<span class="normal">
public
<a href="#">UiSelector</a>
</span>
<span class="sympad">selected</span>
<span class="normal">(boolean val)</span>
</h4>
<div class="api-level">
<div></div>
</div>
<div class="jd-details-descr">
<div class="jd-tagdata jd-tagdescr"><p>Set the search criteria to match widgets that
are currently selected.
Typically, using this search criteria alone is not useful.
You should also include additional criteria, such as text,
content-description, or the class name for a widget.
If no other search criteria is specified, and there is more
than one matching widget, the first widget in the tree
is selected.</p></div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Parameters</h5>
<table class="jd-tagtable">
<tr>
<th>val</td>
<td>Value to match</td>
</tr>
</table>
</div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Returns</h5>
<ul class="nolist"><li>UiSelector with the specified search criteria</li></ul>
</div>
</div>
</div>
<A NAME="text(java.lang.String)"></A>
<div class="jd-details api">
<h4 class="jd-details-title">
<span class="normal">
public
<a href="#">UiSelector</a>
</span>
<span class="sympad">text</span>
<span class="normal">(String text)</span>
</h4>
<div class="api-level">
<div></div>
</div>
<div class="jd-details-descr">
<div class="jd-tagdata jd-tagdescr"><p>Set the search criteria to match the visible text displayed
in a widget (for example, the text label to launch an app).
The text for the element must match exactly with the string in your input
argument. Matching is case-sensitive.</p></div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Parameters</h5>
<table class="jd-tagtable">
<tr>
<th>text</td>
<td>Value to match</td>
</tr>
</table>
</div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Returns</h5>
<ul class="nolist"><li>UiSelector with the specified search criteria</li></ul>
</div>
</div>
</div>
<A NAME="textContains(java.lang.String)"></A>
<div class="jd-details api">
<h4 class="jd-details-title">
<span class="normal">
public
<a href="#">UiSelector</a>
</span>
<span class="sympad">textContains</span>
<span class="normal">(String text)</span>
</h4>
<div class="api-level">
<div></div>
</div>
<div class="jd-details-descr">
<div class="jd-tagdata jd-tagdescr"><p>Set the search criteria to match the visible text in a widget
where the visible text must contain the string in your input argument.
The matching is case-sensitive.</p></div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Parameters</h5>
<table class="jd-tagtable">
<tr>
<th>text</td>
<td>Value to match</td>
</tr>
</table>
</div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Returns</h5>
<ul class="nolist"><li>UiSelector with the specified search criteria</li></ul>
</div>
</div>
</div>
<A NAME="textMatches(java.lang.String)"></A>
<div class="jd-details api">
<h4 class="jd-details-title">
<span class="normal">
public
<a href="#">UiSelector</a>
</span>
<span class="sympad">textMatches</span>
<span class="normal">(String regex)</span>
</h4>
<div class="jd-details-descr">
<div class="jd-tagdata jd-tagdescr"><p>Set the search criteria to match the visible text displayed in a layout
element, using a regular expression.
The text in the widget must match exactly with the string in your
input argument.</p></div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Parameters</h5>
<table class="jd-tagtable">
<tr>
<th>regex</td>
<td>a regular expression</td>
</tr>
</table>
</div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Returns</h5>
<ul class="nolist"><li>UiSelector with the specified search criteria</li></ul>
</div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Since</h5>
<ul class="nolist"><li>Android API Level 17</li></ul>
</div>
</div>
</div>
<A NAME="textStartsWith(java.lang.String)"></A>
<div class="jd-details api">
<h4 class="jd-details-title">
<span class="normal">
public
<a href="#">UiSelector</a>
</span>
<span class="sympad">textStartsWith</span>
<span class="normal">(String text)</span>
</h4>
<div class="api-level">
<div></div>
</div>
<div class="jd-details-descr">
<div class="jd-tagdata jd-tagdescr"><p>Set the search criteria to match visible text in a widget that is
prefixed by the text parameter.
The matching is case-insensitive.</p></div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Parameters</h5>
<table class="jd-tagtable">
<tr>
<th>text</td>
<td>Value to match</td>
</tr>
</table>
</div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Returns</h5>
<ul class="nolist"><li>UiSelector with the specified search criteria</li></ul>
</div>
</div>
</div>
<A NAME="toString()"></A>
<div class="jd-details api">
<h4 class="jd-details-title">
<span class="normal">
public
String
</span>
<span class="sympad">toString</span>
<span class="normal">()</span>
</h4>
<div class="api-level">
<div></div>
</div>
<div class="jd-details-descr">
<div class="jd-tagdata jd-tagdescr"><p></p></div>
</div>
</div>
<!-- ========= METHOD DETAIL ======== -->
<h2>Protected Methods</h2>
<A NAME="cloneSelector()"></A>
<div class="jd-details api">
<h4 class="jd-details-title">
<span class="normal">
protected
<a href="#">UiSelector</a>
</span>
<span class="sympad">cloneSelector</span>
<span class="normal">()</span>
</h4>
<div class="jd-details-descr">
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Since</h5>
<ul class="nolist"><li>Android API Level 17</li></ul>
</div>
</div>