[英]How to click the element using automation id in Xamarin.UiTest?
The app is developed using Xamarin.forms. 该应用程序是使用Xamarin.forms开发的。 I am examining the app using repl().
我正在使用repl()检查该应用程序。 While using tree command i can see following output
使用树命令时,我可以看到以下输出
>>> tree
[[object CalabashRootView] > DecorView]
[LinearLayout > FrameLayout]
[FitWindowsFrameLayout] id: "action_bar_root"
[ContentFrameLayout > ... > PlatformRenderer] id: "content"
[NavigationPageRenderer] id: "NoResourceEntry-9"
[PageContainer] id: "NoResourceEntry-22"
[PageRenderer > Platform_DefaultRenderer] id: "NoResourceEntry-17"
[Platform_DefaultRenderer] label: "TermsAndConditions_main"
[Platform_DefaultRenderer]
[Platform_DefaultRenderer]
[BoxRenderer] label: "TermsAndConditions_boxview"
[ExtendedLabelRenderer] label: "TermsAndConditions_lbTitle_Container"
[FormsTextView] id: "NoResourceEntry-18", label: "TermsAndConditions_lbTitle", text: "TERMS & CONDITIONS"
[BoxRenderer] label: "TermsAndConditions_boxview1"
[WebViewRenderer] label: "TermsAndConditions_webViewText_Container"
[WebView] id: "NoResourceEntry-19", label: "TermsAndConditions_webViewText"
[Platform_DefaultRenderer] label: "TermsAndConditions_btn"
[FrameRenderer > LabelRenderer] id: "NoResourceEntry-20"
[FormsTextView] id: "NoResourceEntry-21" text: "Accept"
[View] id: "statusBarBackground"
All the automation Id is represented in the tree by label
tag. 树中的所有自动化ID均由
label
标记表示。 How can i interact with the element with the label
tag? 如何与带有
label
标签的元素进行交互?
For example, i want to click the element with label TermsAndConditions_btn
. 例如,我想单击带有标签
TermsAndConditions_btn
的元素。 How can i do this in Xamarin Uitest?? 我如何在Xamarin Uitest中做到这一点?
Get the label with something like static readonly Func<AppQuery, AppQuery> MyLabel = c => c.Marked("TermsAndConditions_btn");
使用
static readonly Func<AppQuery, AppQuery> MyLabel = c => c.Marked("TermsAndConditions_btn");
获取标签static readonly Func<AppQuery, AppQuery> MyLabel = c => c.Marked("TermsAndConditions_btn");
and then call app.Tap(MyLabel)
. 然后调用
app.Tap(MyLabel)
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.