swift – iOS: Automation cannot learn a component with accessibilityIdentifier when isAccessibilityElement is about


To illustrate we have now UIView and it accommodates two UILabels. For automation take a look at to entry one of many label, we have set accessibilityIdentifier to one of many label.

Now, we need to assist VoiceOver on our app. I’ve set isAccessibilityElement to true to VoiceOver.
VoiceOver works effectively however the automation take a look at is failing and saying, he cannot establish the label with the accessibilityIdentifier.

Is there a method, we are able to work round this?

I attempted one thing like this. (isAccessibilityElement = false)

        isAccessibilityElement = false
        var parts = [Any]()
        let accessibilityElement = UIAccessibilityElement(accessibilityContainer: self)
        accessibilityElement.accessibilityHint = "VoiceOver, learn this"
        accessibilityElement.accessibilityFrameInContainerSpace = bounds
        parts.append(accessibilityElement)
        parts.append(label1)
        parts.append(label2)
        accessibilityElements = parts

However had no luck with the automation take a look at.

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles