본문 바로가기
iOS/설명

[iOS] accessbilityIdentifier

by Sky Titan 2022. 9. 25.
728x90
 

Apple Developer Documentation

 

developer.apple.com

 

 

accessibilityLabel / accessibilityIdentifier

안녕하세요 :) Zedd입니다. 제가 이 글에서 이렇게 말했었는데요. 네 맞는 말입니다! UITest에서는 유니크한 accessibilityLabel 또는 accessibilityIdentifier로 UI Element를 가져올 수 있어요. 그러면 access..

zeddios.tistory.com

accessbilityIdentifier

  • UI Test에서 UI Element에 접근할 때, 식별자로 사용함.
    • UI Test는 XC Test + Accessbility의 조합으로 실행된다.
  • 사용 시 주의
    • localizing이 되어선 안된다. -> UI Test에서 UI Element를 찾을 때, 로컬라이징이 되어있는 Identifier는 제대로 찾지 못한다.

 

accessbilityLabel vs accessbilityIdentifier

  • 둘 다 UITest에서 UI Element를 식별할 때 사용이 가능
  • 단 대상자가 다르다.
    • accessbilityLabel
      • 최종 사용자 (end-user)를 대상으로 하기 때문에 Voice Over 사용자들은 accessbilityLabel의 들어있는 값을 듣게 된다.
      • 그렇기 때문에 localizing된 텍스트가 들어가는 것이 좋다.
    • accessbilityIdentifier
      • 개발자들을 대상으로 한다.
      • 순수하게 UITest에서 UI Element를 식별할 때 사용한다.
      • localizing이 되어있으면 UITest에서 언어 환경이 바뀔 때, UI Element를 제대로 못 찾기 때문에 localizing을 하지 말아야 한다.
  • 둘 다 UITest에서 활용 가능하지만 localizing과 사용 대상의 문제로, UITest 작성 시엔 accessbilityIdentifer를 사용하는 것이 맞다.
728x90

댓글