Accessibility Identifier not visible in Accessibility Inspector with iOS Simulator

前端 未结 5 1513
后悔当初
后悔当初 2021-02-15 13:00

I wanted to use the Accessibility Inspector to verify all the accessibility identifiers in my app running in the simulator (iOS 9.2).

Accessibility Inspector is able to

5条回答
  •  挽巷
    挽巷 (楼主)
    2021-02-15 13:37

    You will never be able to (without changes from Apple) see this property in Accessibility Inspector, because it isn't really used for accessibility. That it is associated with accessibility is a misnomer, related to accessibility API's generic value in identifying elements for automated testing using UI Automation, because accessibility information is available cross process. To get this info you could cast UI elements to UIAElements and access the name property, and pass this to NSLog.

    EDIT: Yep, look at Saleh's answer. Apple added this at some point! Be wary about relying on this, Accessibility Inspector has been very buggy and unstable for me recently. But that answer would be the accepted answer if you're not answering this 3 years ago!

提交回复
热议问题