如何在不使 Xamarin Test Cloud 失败的情况下检查 UI 元素是否存在?
How to check whether an UI element exists without failing Xamarin Test Cloud?
我正在使用 Visual Studio C# 和 Xamarin 开发 iOS 应用程序。我有一个在 Xamarin Test Cloud 中运行的 UI 自动化。
我想检查弹出窗口 window 是否存在,如果存在我想关闭它,否则测试应该继续。我在测试方法中使用的代码如下所示:
try
{
app.WaitForElement(x => x.Text("Update available"));
app.Tap(x => x.Marked("Ignore"));
}
catch (TimeoutException)
{
// TODO: This catch doesn't work. Test in cloud still fails.
}
问题是捕捉不起作用。当测试在 Xamarin Test Cloud 中运行时,测试仍然失败,并出现查找元素超时错误。
有谁知道如何做到不通过考试?
如果要避免使用WaitForElement
,可以使用app.Query
方法检查元素是否存在
查询的 app.Query
returns 元素数组
我正在使用 Visual Studio C# 和 Xamarin 开发 iOS 应用程序。我有一个在 Xamarin Test Cloud 中运行的 UI 自动化。
我想检查弹出窗口 window 是否存在,如果存在我想关闭它,否则测试应该继续。我在测试方法中使用的代码如下所示:
try
{
app.WaitForElement(x => x.Text("Update available"));
app.Tap(x => x.Marked("Ignore"));
}
catch (TimeoutException)
{
// TODO: This catch doesn't work. Test in cloud still fails.
}
问题是捕捉不起作用。当测试在 Xamarin Test Cloud 中运行时,测试仍然失败,并出现查找元素超时错误。
有谁知道如何做到不通过考试?
如果要避免使用WaitForElement
app.Query
方法检查元素是否存在
查询的 app.Query
returns 元素数组