Xamarin UITest 不会将密钥发送到 Android 版本 10



请协助,因为我在使用 xamarin UITest 时遇到问题,EnterText 方法不会向 Android 版本 10 设备发送任何密钥。 Repl(( 显示文本已输入,但在实际设备上没有插入任何内容。代码在Android版本9及以下版本上运行良好,在此处输入图像描述

xamarin ui 测试存在错误,请参阅 https://github.com/microsoft/appcenter/issues/1451

我实施了以下解决方法:

protected bool OnAndroid => AppManager.Platform == Platform.Android;
protected bool OniOS => AppManager.Platform == Platform.iOS;
public void SetEntryText(Query entry, string entryName, string value)
{
if (OnAndroid)
{
app.Query(e => e.Marked(entryName).Invoke("setText", value));
}
else if (OniOS)
{
app.ClearText(entry);
app.EnterText(entry, value);
}
}

最新更新