如何在UI自动化元素上模拟双击动作? [英] How to simulate a double click action on an UI Automation Element?

查看:599
本文介绍了如何在UI自动化元素上模拟双击动作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

有人知道如何在UI自动化元素上模拟双击动作吗?在这种情况下,我不想使用UITestControl元素

Does any one know how to simulate a double click action on an UI Automation Element? I don't want to use UITestControl element in this case

例如:双击列表视图"中的一行以对其进行编辑.

For example: Double click on a row in List View to edit its.

先谢谢您

Phong

推荐答案

嗨Phong,

Hi Phong,

UIA没有提供一种专门模拟元素上双击(或右键单击)的方法.但是根据UI的类型,UIA可能可以通过编程方式触发双击时所发生的相同操作.

UIA doesn’t provide a way to specifically simulate a double click (or right click) on an element. But depending on the type of UI, UIA might be able to programmatically trigger the same action that happens when you do a double click.

因此,我刚刚使用Inspect SDK工具查看了一些ListView项目.使用Inspect,我可以看到这些项目支持Invoke模式.因此,使用UIA,我应该能够获取任何项目的Invoke模式,并调用Invoke()方法 从那开始.我希望这将导致相同的操作,就像我用鼠标双击该项目一样. (查看该项目支持的其他模式,可以看到可以使用UIA来选择它,或者如果需要,可以将其滚动到视图中.)

So I’ve just taken a look at some ListView items using the Inspect SDK tool. Using Inspect, I can see that the items support the Invoke pattern. So using UIA I should be able to get the Invoke pattern for any of the items, and call the Invoke() method from that. I would expect that would lead to the same action as if I’d double clicked the item with the mouse. (Looking at the other patterns that the item supports, I can see that I could use UIA to select it, or scroll it into view if I wanted.)

我注意到此主题之前在 http://social.msdn.microsoft.com/Forums/zh-CN/windowsaccessibilityandautomation/thread/f267ed90-13cd-44b6-9ce2-95b3210176f3 ,但是该线程上的某人说他们正在查看的UI并未支持调用模式.我总是建议使用 在尝试通过自己的UIA客户端代码获取模式之前,请使用Inspect工具检查您感兴趣的UI支持哪些模式.

I notice this topic has come up before at http://social.msdn.microsoft.com/Forums/en-US/windowsaccessibilityandautomation/thread/f267ed90-13cd-44b6-9ce2-95b3210176f3, but someone on that thread said the UI they were looking at did not support the Invoke pattern. I’d always recommend using the Inspect tools to check what patterns are supported by the UI you’re interested in, before trying to gets the patterns through your own UIA client code.

谢谢


这篇关于如何在UI自动化元素上模拟双击动作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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