Use Selectors for Mobile Sessions
Identify selectors and filter sessions with selectors
Filtering by selectors
LogRocket automatically captures every user interaction with your application - allowing you to search retroactively for sessions where users interacted with specific buttons or screens.
To search for sessions, use the "Clicked on Selector" filter as shown below:


Components of a View Selector for Android Native
Selectors are generated from hierarchical view details and support a subset of the CSS specification syntax.
Component | Value | Note |
---|---|---|
Element | view.getClass().getSimpleName() | |
#resource-id | view.getResources().getResourceName(view.getId()) | Only the portion after id/ is captured. |
.tag-text | view.getTag() | Only instances of String are captured. |
For example, an EsditText
with this definition:
<EditText
android:id="@+id/user_email"
android:tag="test-email-input"
... />
the following Selector would be generated:
EditText.test-email-input#user_email
Components of a View Selector for React Native - Android Devices
Component | Value | Note |
---|---|---|
Element | view.getClass().getSimpleName() | This is not the React element name, but the native view that React uses to render |
#resource-id | N/A | Resources only apply to Android Native |
.tag-text | testID |
Components of a View Selector for React Native - iOS Devices
Element | iOS View Class Name | |
#resource-id | the accessibilityIdentifier assigned to the view | |
.tag-text | is an automated "tag" that is generated for list items indicating their element position. |
Querying Selectors
For each touch event, or 'click', a hierarchy of views is computed from the touched view to the top view of the Activity. The following forms of querying are supported:
- Single element:
Button
-- will match anyButton
element. - Specific ID:
#signin
-- will match any view with a Resource ID of - Specific Tag:
.tag-value
-- will match any view with that tag text - Combined selectors: an element may be followed by either or both of a Specific ID and Specific Tag.
- Nesting: multiple selectors may be separated by a space, and will enforce a mathing hierarchy.
- Child Of: a selector in the form of
a > b
matches any viewb
that is a direct child of the viewa
.
Updated about 1 month ago