Appium Inspector 无法在 iOS Element Hierarchy 中定位子元素 [英] Appium Inspector is unable to locate the child elements in iOS Element Hierarchy
问题描述
应用程序构建于:React Native 0.62.2
Apps built on : React Native 0.62.2
用于测试的工具:Appium v1.17.1
Tool used for Testing : Appium v1.17.1
问题描述:Appium Inspector 未检查/定位 iOS 层次结构中的子元素.
Issue Description : The Child Elements in the iOS hierarchy are not getting inspected/located by Appium Inspector.
我们使用 testID 和 accessibilityLabel 属性为元素提供 ID:
We are giving IDs to elements using testID and accessibilityLabel properties :
返回{测试ID:ID,可访问性标签:id,};
return { testID: id, accessibilityLabel: id, };
但 appium 仍然无法识别 iOS 层次结构中的元素.
But still the appium is not able to identify the elements in the iOS hierarchy.
在 Android Element Hierarchy 上,我们看到元素ingredient_row_container_radish_wedges"的子元素
On Android Element Hierarchy we see the Child elements of the element "ingredient_row_container_radish_wedges"
安卓应用源:
但是在iOS上我们看不到元素ingredient_row_container_radish_wedges"的子元素
But on iOS we don’t see the child elements of the element "ingredient_row_container_radish_wedges"
iOS 应用程序来源:
iOS App Source :
推荐答案
创建一个包含以下内容的类:
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
<查看{...可访问性('ingredient_row_container_radish_wedges')}>
<View {... accessibility('ingredient_row_container_radish_wedges')}>
这篇关于Appium Inspector 无法在 iOS Element Hierarchy 中定位子元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!