I would like to know if there is a possibility to use in EarlGrey something like
[[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(@"Log in")] performAction:grey_tap().elementByIndex(0)]
(either with grey_accessibilityLabel
or grey_text
)
Very often in our APP exist situations where multiple elements could be found, need a solution to prevent it.
I know that is better to use Accessibility ID to do not face such problems but current state of the APP is that it doesn't have any IDs.
I asked a similar question a while back -
EarlGrey - How do I check if multiple objects are being shown on the screen
EarlGrey encourages using unique matchers for finding elements since using elementByIndex() can cause issues if the order isn't always maintained. You could also write a custom matcher that performs the checks you need as is highlighted in the answer.