Apps built on : React Native 0.62.2
Tool used for Testing : Appium v1.17.1
Issue Description : The Child Elements in the iOS hierarchy are not getting inspected/located by Appium Inspector.
We are giving IDs to elements using testID and accessibilityLabel properties :
return { testID: id, accessibilityLabel: id, };
But still the appium is not able to identify the elements in the iOS hierarchy.
On Android Element Hierarchy we see the Child elements of the element “ingredient_row_container_radish_wedges”
But on iOS we don’t see the child elements of the element “ingredient_row_container_radish_wedges”
create a class with following content:
import { Platform } from 'react-native';
export function accessibility(id?: string) {
return Platform.OS === 'android'
? { accessible: true, accessibilityLabel: id }
: { accessible: false, testID: id };
}
and import 'accessibility' function where you want to use then use it as props
<View {... accessibility('ingredient_row_container_radish_wedges')}>