【问题标题】:Appium Inspector is unable to locate the child elements in iOS Element HierarchyAppium Inspector 无法在 iOS Element Hierarchy 中定位子元素
【发布时间】:2020-12-24 07:46:06
【问题描述】:

基于构建的应用:React Native 0.62.2

用于测试的工具:Appium v​​1.17.1

问题描述:iOS 层次结构中的子元素没有被 Appium Inspector 检查/定位。

我们使用 testID 和 accessibilityLabel 属性为元素提供 ID:

返回{ 测试ID:身份证, 可访问性标签:id, };

但 appium 仍然无法识别 iOS 层次结构中的元素。

在 Android 元素层次结构中,我们看到元素“ingredient_row_container_radish_wedges”的子元素

Android 应用程序来源:

但在 iOS 上,我们看不到元素“ingredient_row_container_radish_wedges”的子元素

iOS 应用源:

【问题讨论】:

    标签: react-native appium appium-ios


    【解决方案1】:

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

    import { Platform } from 'react-native';
    
    export function accessibility(id?: string) {
      return Platform.OS === 'android'
        ? { accessible: true, accessibilityLabel: id }
        : { accessible: false, testID: id };
    }
    

    然后在您想使用的地方导入“辅助功能”功能 作为道具使用

    【讨论】:

      猜你喜欢
      • 2020-08-06
      • 2017-01-20
      • 1970-01-01
      • 2014-07-27
      • 2021-11-25
      • 1970-01-01
      • 2018-03-15
      • 2016-09-05
      • 2019-11-18
      相关资源
      最近更新 更多