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:

1360 1266

Components of a View Selector for Android Native

Selectors are generated from hierarchical view details and support a subset of the CSS specification syntax.

ComponentValueNote
Elementview.getClass().getSimpleName()
#resource-idview.getResources().getResourceName(view.getId())Only the portion after id/ is captured.
.tag-textview.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

ComponentValueNote
Elementview.getClass().getSimpleName()This is not the React element name, but the native view that React uses to render
#resource-idN/AResources only apply to Android Native
.tag-texttestID

Components of a View Selector for React Native - iOS Devices

ElementiOS View Class Name
#resource-idthe accessibilityIdentifier assigned to the view
.tag-textis 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 any Button 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 view b that is a direct child of the view a.