C# 是否可以在xamarin ui测试中使用monotouch uikit
我目前正在编写ui测试,我希望能够检查TableViewCell是否已被选中。我看到monotouch uikit中列出了一种选定的方法。我尝试过使用它,但没有结果(见下面的代码)。有人知道如何将其用于UI测试吗C# 是否可以在xamarin ui测试中使用monotouch uikit,c#,xamarin,xamarin.ios,xamarin.uitest,C#,Xamarin,Xamarin.ios,Xamarin.uitest,我目前正在编写ui测试,我希望能够检查TableViewCell是否已被选中。我看到monotouch uikit中列出了一种选定的方法。我尝试过使用它,但没有结果(见下面的代码)。有人知道如何将其用于UI测试吗 app.Query(e => e.Class("UITableViewCell.Selected")); app.Query(e => e.Class("UITableViewCell").Selected); 您需要调用ObjC名称,而不是C#one 因此,对于UITa
app.Query(e => e.Class("UITableViewCell.Selected"));
app.Query(e => e.Class("UITableViewCell").Selected);
您需要调用
ObjC
名称,而不是C#one
因此,对于UITableViewCell
,选择的方法是isSelected
,参数为零
关于:
在测试中,可以使用Invoke
类似于:
app.Query(e => e.Id("IdTestCell").Class("UITableViewCell").Invoke("isSelected", 0).Value<bool>());
app.Query(e=>e.Id(“IdTestCell”).Class(“UITableViewCell”).Invoke(“isSelected”,0.Value());
结果:
Query for Id("IdTestCell").Class("UITableViewCell").Invoke("isSelected", 0).Value<Boolean>() gave 1 results.
[
[0] true
]
查询Id(“IdTestCell”).Class(“UITableViewCell”).Invoke(“isSelected”,0).Value()得到1个结果。
[
[0]正确
]
谢谢@sushingover