Fan*_*ala 0 appium react-native appium-ios
应用程序构建于:React Native 0.62.2
\n测试使用工具:Appium v1.17.1
\n问题描述:Appium Inspector 未检查/定位 iOS 层次结构中的子元素。
\n我们使用 testID 和accessibilityLabel 属性为元素提供ID:
\n返回 {\ntestID: id,\naccessibilityLabel: id,\n};
\n但 appium 仍然无法识别 iOS 层次结构中的元素。
\n在 Android 元素层次结构中,我们看到元素 \xe2\x80\x9cingredient_row_container_radish_wedges\xe2\x80\x9d 的子元素
\n\n但在 iOS 上,我们看不到 \xe2\x80\x99t 元素 \xe2\x80\x9cingredient_row_container_radish_wedges\xe2\x80\x9d 的子元素
\n\n创建一个包含以下内容的类:
import { Platform } from 'react-native';
export function accessibility(id?: string) {
return Platform.OS === 'android'
? { accessible: true, accessibilityLabel: id }
: { accessible: false, testID: id };
}
Run Code Online (Sandbox Code Playgroud)
并在您想要使用的地方导入“辅助功能”功能,然后将其用作道具
<查看{...可访问性('ingredient_row_container_radish_wedges')}>
| 归档时间: |
|
| 查看次数: |
2327 次 |
| 最近记录: |