无法检查/与iOS互动以对Appium中的本机应用程序元素做出反应

问题描述

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

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

代码段-

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

请告知我是否有任何解决方案。

enter image description here

解决方法

你不应该为ios指定accessibilityLabel ios 和 android 的单独道具,如下所示:

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

然后

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