找不到 appium ID,因为所有 ID 都显示为正方形

Can't find appium ID because all the IDs are showing up as squares

Appium 将我放入代码中的所有 ID 显示为简单的方块。就像,真正的 s。

尝试开始记录自己选择的元素,这样我就可以检查是否确实找到了 ID,或者 Appium 是否只是出了点问题,但即使是记录器上的代码也会在 xPath 上显示一个。

记录器的输出:

let el3 = await driver.elementByXPath("(//XCUIElementTypeOther[@name=\"\"])[2]");
await el3.click();

Fiddle 当我尝试记录自己选择一个元素时输出 appium 显示:

https://jsfiddle.net/3pLfhdmn/

运行 iOS、Xcode 版本 11.3.1 (11C504)。我的应用程序是基于 react-native 构建的。

以下是我尝试将 ID 插入代码的方法:

<Button
  onPress={() => this.setState({ routeName: GLOBALS.NAVIGATOR.GUIAS_PENDENTES })}
  style={{ marginBottom: 4 }}
  badge
  name="teste"
  testID="teste"
  accessibilityIdentifier="teste"
  vertical
>
  {renderIf(
    this.state.qtdePendencias > 0,
    <Badge style={{ position: "absolute", marginLeft: 16, marginTop: 5 }}>
      <Text>{this.state.qtdePendencias}</Text>
    </Badge>
  )}
  <MaterialCommunityIcons
    name="alert-outline"
    style={{
      fontSize: 30,
      color: this.state.routeName == GLOBALS.NAVIGATOR.GUIAS_PENDENTES
        ? "#308EE7"
        : "#707070"
    }}
  />
</Button>;

解决了我自己的问题。

当您不在代码中添加任何 ID (testID='testID') 时,Appium 会将 ID 显示为 。

我没有看到任何 ID,因为我的 Xcode 有一些缓存。清理它,重新启动我的 Mac,它现在可以正常工作了。