无法 Android Xamarin Forms UITest 单击 DisplayAlert 按钮
Cannot Android Xamarin Forms UITest to click on DisplayAlert button
我正在使用 Xamarin UITest 来执行 UI 单元测试。我不知道如何让 UI 测试框架点击 DisplayAlert(...) 按钮。
// this query finds the YES button on the Alert
app.WaitForElement( c => c.Marked( "YES" ).Parent().Class( "AlertDialogLayout" ), "ERR", TimeSpan.FromSeconds( 1 ) );
// but tap with the same query doesn't click it
app.Tap( c => c.Marked( "YES" ).Parent().Class( "AlertDialogLayout" ) );
令人惊讶的是,至少对我来说,app.Tap() 不需要也不接受查询来查找 app.WaitForElement() 所需要的弹出按钮。以下作品:
// this query finds the YES button on the Alert
app.WaitForElement( c => c.Marked( "YES" ).Parent().Class( "AlertDialogLayout" ), "ERR", TimeSpan.FromSeconds( 1 ) );
// but tap with the same query doesn't click it
// but "YES" does!
app.Tap( "YES" );
我正在使用 Xamarin UITest 来执行 UI 单元测试。我不知道如何让 UI 测试框架点击 DisplayAlert(...) 按钮。
// this query finds the YES button on the Alert
app.WaitForElement( c => c.Marked( "YES" ).Parent().Class( "AlertDialogLayout" ), "ERR", TimeSpan.FromSeconds( 1 ) );
// but tap with the same query doesn't click it
app.Tap( c => c.Marked( "YES" ).Parent().Class( "AlertDialogLayout" ) );
令人惊讶的是,至少对我来说,app.Tap() 不需要也不接受查询来查找 app.WaitForElement() 所需要的弹出按钮。以下作品:
// this query finds the YES button on the Alert
app.WaitForElement( c => c.Marked( "YES" ).Parent().Class( "AlertDialogLayout" ), "ERR", TimeSpan.FromSeconds( 1 ) );
// but tap with the same query doesn't click it
// but "YES" does!
app.Tap( "YES" );