【问题标题】:how to work with date picker in xamarin android ui test automation如何在 xamarin android ui 测试自动化中使用日期选择器
【发布时间】:2017-02-27 10:31:05
【问题描述】:

我在 xamarin android UI 自动化中工作,我 只是想知道如何从 android 日期选择器中选择特定日期

【问题讨论】:

    标签: c# xamarin-studio ui-testing


    【解决方案1】:

    可能最简单的方法是使用 Xamarin 测试记录器: https://developer.xamarin.com/guides/testcloud/testrecorder/?ide=xs

    如果您使用的是 Visual Studio,该工具仍处于预览阶段,需要 Visual Studio Enterprise 订阅: https://developer.xamarin.com/guides/testcloud/testrecorder/?ide=vs

    测试记录器允许您与应用交互,并且将根据您的交互生成测试。

    您可以做的另一件事是使用 Repl() 方法打开终端 (Mac)/命令行 (Windows) 实例,您可以在其中检查可视化树并找到屏幕上的所有元素。看: https://developer.xamarin.com/guides/testcloud/uitest/working-with/repl/

    进入 REPL 后,您可以使用 tree 命令以 Json 格式查看所有可见的 UI 元素,该格式向您显示视觉元素的类型和一些属性。您还可以像在 UITest 项目中一样执行任何查询,以便查看从查询中得到的结果。

    【讨论】:

    • repl 对此不起作用,因为它将日期选择器作为单个元素读取,因此无法进行交互。测试记录器会让你选择一个日期,但代码不能用于不同的日期选择器
    • @FrankAnderson 您必须点击它(或尝试调用 EnterText)才能触发日期选择器弹出窗口。结果,新元素将出现在树中,您可以选择它们
    猜你喜欢
    • 1970-01-01
    • 2017-10-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-04-29
    • 2018-09-03
    • 2023-03-10
    • 1970-01-01
    相关资源
    最近更新 更多