0

Is ReactNative's accessibilityLabel and iOS Label retrieved using iOS Accessibility Inspector one & the same?

Same goes for Android Text retrieved using UIAutomatorViewer

enter image description here

enter image description here

enter image description here

We are planning to rely heavily on accessibilityLabel in ReactNative for Appium /webdriverIO driven automated tests. Will it be sustainable?

Or shall we use in combination traditional iOS predicate / iOS classchain / Android XPath etc locators?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
user2451016
  • 1,857
  • 3
  • 20
  • 44

1 Answers1

1

According to RN docs http://facebook.github.io/react-native/docs/accessibility, you need to provide accessible={true} prop to the element that you want to use accssibilty, then you can add accessibilityLabel to that element. for Ex :-

<TouchableOpacity
  accessible={true}
  accessibilityLabel="Go back"
  accessibilityHint="Navigates to the previous screen"
  onPress={this._onPress}
  >
   <View style={styles.button}>
     <Text style={styles.buttonText}>Back</Text>
   </View>
</TouchableOpacity>

you can more details about this in RN docs http://facebook.github.io/react-native/docs/accessibility.

Prince
  • 821
  • 5
  • 10
  • That's correct. But could you please confirm - whatever string that we supply in the accessibilityLabel gets translated into 'Label' field in iOS Accessibility inspector/corresponding field in the Android.? – user2451016 Feb 12 '19 at 15:58