Xamarin UITest:如何 select Android 上的 NumberPicker 中的字符串
Xamarin UITest: How to select a string in a NumberPicker on Android
我们的应用程序在不同的地方都有 NumberPickers,其中包含所有字符串值。我想 select 使用字符串值而不是整数值的值。任何帮助是极大的赞赏。
我试过了
app.Query(x => x.Class("EditText").Invoke("setText", "cat"));
它实际上设置了文本,但是在保存值时它会恢复为原始值 selection.
我不想使用以下代码,因为它使用整数值设置值。
app.Query(x=>x.Class("NumberPicker").调用("setValue", 2))
如果有人可以使用字符串值帮助我 select NumberPicker 中的值,那就太好了。
打开数字选择器后,在 Android 上,您可以使用以下代码 select 使用字符串值的 NumberPicker 值(使用 Xamarin Forms Gallery 应用程序的示例):
app.ScrollDownTo(m => m.Text("White"), x => x.Id("select_dialog_listview"));
app.Tap(x => x.Text("White"));
Assert.IsTrue(app.Query("PickerControl")[0].Text == "White");
我们的应用程序在不同的地方都有 NumberPickers,其中包含所有字符串值。我想 select 使用字符串值而不是整数值的值。任何帮助是极大的赞赏。
我试过了 app.Query(x => x.Class("EditText").Invoke("setText", "cat")); 它实际上设置了文本,但是在保存值时它会恢复为原始值 selection.
我不想使用以下代码,因为它使用整数值设置值。 app.Query(x=>x.Class("NumberPicker").调用("setValue", 2)) 如果有人可以使用字符串值帮助我 select NumberPicker 中的值,那就太好了。
打开数字选择器后,在 Android 上,您可以使用以下代码 select 使用字符串值的 NumberPicker 值(使用 Xamarin Forms Gallery 应用程序的示例):
app.ScrollDownTo(m => m.Text("White"), x => x.Id("select_dialog_listview"));
app.Tap(x => x.Text("White"));
Assert.IsTrue(app.Query("PickerControl")[0].Text == "White");