Metro风格应用的UI自动化怎么做? [英] How to do UI Automation of Metro-Style Apps?

查看:26
本文介绍了Metro风格应用的UI自动化怎么做?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经下载并安装了 Windows 8 消费者预览版,我想弄清楚如何使用 UI 自动化 API 从 Metro 风格应用程序中获取数据.

背景:我有很多自动化测试使用 Microsoft UI 自动化 API 与应用程序交互.这些脚本是用 IronRuby 编写的,针对 .NET 4

最初,我只想检查开始菜单是否可见(如果是,请关闭它)

据微软称,正常的 UI 自动化 API 应该能够访问和控制 Metro 风格的应用程序,但问题是,我无法弄清楚我的代码如何实际访问 Metro 应用程序的 UI?我们查看 UI 自动化数据的常规方法是使用 UISpy,但是当我在 Windows 8 下运行 UI 间谍并调出一个 Metro 应用程序,没有提及它...似乎 Metro 应用程序(包括开始屏幕)与桌面隔离了.

如果我在 UISpy 中找不到 Metro 应用程序,我如何找到它们的自动化 ID,以及如何从我的自动化测试脚本中找到它们?

解决方案

关于适用于 Metro 风格应用的 UI 自动化的一些资源:

  • 这里有一个示例来演示它.>

  • 这是一个 博客文章 解释它.

  • 这是一个论坛主题 关于该主题.

    该应用不会阻止传统 UI 自动化正常工作.您可能需要获取更新的工具才能查看 Metro 风格的应用程序.有些随消费者预览版一起提供.寻找inspect.exe.

I've downloaded and installed the windows 8 consumer preview, and I'd like to figure out how to use the UI Automation API's to get data from metro style applications.

Background: I have a lot of automated tests which use the Microsoft UI Automation API's to interact with applications. The scripts are written in IronRuby against .NET 4

Initially, I'd simply like to check if the start menu is visible (and if so, close it)

According to Microsoft, the normal UI Automation API's should be able to access and control metro style applications, but the problem is, I can't figure out how my code can actually access the UI of metro applications? Our normal way of viewing UI automation data is using UISpy, however when I run UI spy under windows 8 and bring up a metro app, there is no mention of it... it seems like metro apps (including the start screen) are walled off from the desktop.

If I can't find the metro apps in UISpy, how can I find what their automation ID's are, and how could I find them from my automated test scripts?

解决方案

A few resources on UI automation which works in Metro style apps:

  • Here is a sample demonstrating it.

  • Here is a blog post explaining it.

  • This is a forum thread on the subject.

    There is nothing about the app that stops traditional UI automation from working correctly. You may have to get updated tools to view the Metro style apps. Some ship with the Consumer Preview. Look for inspect.exe.

这篇关于Metro风格应用的UI自动化怎么做?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆