【问题标题】:Coded UI Test - Working with File Picker Cotnrol编码的 UI 测试 - 使用文件选择器控件
【发布时间】:2014-11-12 13:55:27
【问题描述】:

我正在为 Windows 商店应用程序编写编码的 ui 测试。该应用程序基本上会打开一个文本文件。

所以我能够自动化直到这一点

1 -> 启动应用程序 -> 2 -> 点击打开文件按钮

然后是这个屏幕(Windows 商店应用程序的文件选择器):

现在我想去 D:\ABC\test.txt 并打开 test.txt 文件。如何自动化这部分?

【问题讨论】:

    标签: c#-4.0 coded-ui-tests


    【解决方案1】:

    哇!!!!终于想通了。

    Windows 商店应用的编码 UI 测试仅适用于 XAML 控件。

    开始菜单、文件选择器、超级按钮(例如设置超级按钮)等控件不是 XAML 控件。

    它们属于 DirectUIControl 的类别

    所以我手动创建了这个 DirectUIControl 并将其添加到我的 UI 地图中,它运行良好。

    例如

    DirectUIControl ctrl = new DirectUIControl(//mention the parent control from them);
    ctrl.SearchProperties[DirectUIControl.PropertyNames.AutomationId] = ""; //set the automation id. In my case it was the path to file
    ctrl.WindowTitle.Add(//Title of the window, window in which they existed");
    

    现在他们准备好了。您可以在这些添加的 DirectUIControl(s) 上使用 Mouse.Click 或 Gesture.Tap

    • 普里扬克

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-02-05
      • 1970-01-01
      • 1970-01-01
      • 2018-07-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-23
      相关资源
      最近更新 更多