Appium Inspector 无法在 iOS 元素层次结构中找到子元素

Fan*_*ala 0 appium react-native appium-ios

应用程序构建于:React Native 0.62.2

\n

测试使用工具:Appium v​​1.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

Android 应用程序来源:\n在此输入图像描述

\n

但在 iOS 上,我们看不到 \xe2\x80\x99t 元素 \xe2\x80\x9cingredient_row_container_radish_wedges\xe2\x80\x9d 的子元素

\n

iOS 应用程序源:\n在此输入图像描述

\n

Shi*_*mar 6

创建一个包含以下内容的类:

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')}>