如何在 Xamarin.UiTest 中点击使用自动化 id 的元素?
How to click the element using automation id in Xamarin.UiTest?
该应用程序是使用 Xamarin.forms 开发的。我正在使用 repl() 检查应用程序。使用树命令时,我可以看到以下输出
>>> 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"
所有自动化 ID 在树中由 label
标记表示。我如何与带有 label
标签的元素交互?
例如,我想点击标签为TermsAndConditions_btn
的元素。我怎么能在 Xamarin Uitest 中做到这一点?
获取带有类似 static readonly Func<AppQuery, AppQuery> MyLabel = c => c.Marked("TermsAndConditions_btn");
的标签,然后调用 app.Tap(MyLabel)
。
该应用程序是使用 Xamarin.forms 开发的。我正在使用 repl() 检查应用程序。使用树命令时,我可以看到以下输出
>>> 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"
所有自动化 ID 在树中由 label
标记表示。我如何与带有 label
标签的元素交互?
例如,我想点击标签为TermsAndConditions_btn
的元素。我怎么能在 Xamarin Uitest 中做到这一点?
获取带有类似 static readonly Func<AppQuery, AppQuery> MyLabel = c => c.Marked("TermsAndConditions_btn");
的标签,然后调用 app.Tap(MyLabel)
。