【问题标题】:Unable to inspect/interact with iOS react native app elements in Appium无法检查/与 iOS 交互在 Appium 中反应原生应用程序元素
【发布时间】:2021-01-20 04:12:52
【问题描述】:

我正在尝试查找以下突出显示的会议信息。然而,在 appium 检查器中,所有元素都被组合并显示在一个容器中。 以红色突出显示的三个元素具有不同的测试 ID,但是当我尝试检查时,它会将所有三个元素显示为一个元素。因此,我无法与 iOS 上的任何特定元素进行交互。 我可以检查与 android 应用程序中的不同元素相同的三个元素。它适用于安卓。 p.s - 我也尝试使用可访问性检查器检查元素。结果是一样的。

该应用是针对 Android 和 iOS 的原生反应开发的。 Appium 桌面版- 1.18.0-2

代码 sn-p-

<Card.Content>
          <Title
            accessibilityLabel="testID-meetingTitle"
            testID="testID-meetingTitle"
          >
            {item.name}
          </Title>
          <Text
            style={{ fontSize: 14, lineHeight: 20, color: "rgba(0,0,0,0.6)" }}
            testID-meetingTitle
            accessibilityLabel="testID-meetingInformation"
            testID="testID-meetingInformation"
          >
            {item.date}
          </Text>
        </Card.Content>

如果有相同的解决方案,请告诉我..

【问题讨论】:

  • 你能用导致问题的元素的代码更新你的帖子吗?
  • 我现在已经添加了代码 sn-p。你能建议吗?
  • 它不能与 Xpath 一起使用吗?
  • 要访问iOS中的内部元素,我们需要保持父元素可访问={false}

标签: react-native appium react-native-ios appium-ios appium-desktop


【解决方案1】:

你不应该为ios指定accessibilityLabel ios 和 android 的单独 props 如下:

export default function testID(id) {
    return Platform.OS === 'android'
        ? {
            accessible        : true,
            accessibilityLabel: id,
        }
        : {
            testID: id,
        };
}

然后

<Text
    {...otherProps}
    {...testID('testID-meetingInformation')}
/>

【讨论】:

    猜你喜欢
    • 2017-10-11
    • 2020-12-20
    • 1970-01-01
    • 2015-07-26
    • 1970-01-01
    • 2019-08-24
    • 2019-06-11
    • 1970-01-01
    • 2019-11-30
    相关资源
    最近更新 更多