Appium IOS - element.getAttribute("value") 为 XCUIElementTypeTextField 返回 null,尽管存在值

Appium IOS - element.getAttribute("value") is returning null for XCUIElementTypeTextField although value is present

我在 Appium 工作 iOS 使用 React Native 构建的移动应用程序。

在一个页面中,XCUIElementTypeTextField 是有价值的。但是当我使用 getAttribute("value") 检索它时,它返回 null。



WebElement firstName = MobileBy.iOSClassChain("**/XCUIElementTypeOther[`name == 'First Name'`]/**/XCUIElementTypeTextField[1]");
String actualValue = firstName.getAttribute("value");

我尝试使用其他属性,例如:innerText、name、getText()。但是 none 对我有用。其他页面中的相同 XCUIElementTypeTextField 工作正常。只有在这个页面,我遇到了问题。

XCode版本:11.1
Appium 版本:1.15.1
Appium Java 客户端:7.2.0
硒版本:3.141.59

https://github.com/appium/appium/issues/13594
如上github问题所述:

The issue is known and is XCTest regression. Use Xcode 10 SDK to test iOS 12 and below and Xcode11 for iOS13.

我的 ios 设备是 12.3.1,我的 xcode 是 11。所以更改为 xcode 10,现在工作正常。