Search code examples
xcodexctestxcode-ui-testingapple-tv

Xcode UI Testing Remote Button Error: Failed to find focused element


I'm trying to test UI of an app on Apple TV, however every time I press a UIButton in the UI, I immediately get an error:

"Remote Button Error: Failed to find focused element".

This happens while recording the test.

What can cause the problem, how to solve it?

Reote Button Error screenshot


Solution

  • This is a problem with your app code. When you move to a new view on Apple TV, the focused element should be set on the new view.

    Your error indicates that no element has been given focus after you press the button.

    Focus enables users to see what is currently selected and should involve some sort of visual indication, like having the focused view move towards the user in the Z-axis.