UIAutomation单击使用AutomationElement的Invoke Pattern [英] UIAutomation Click using Invoke Pattern of AutomationElement

查看:708
本文介绍了UIAutomation单击使用AutomationElement的Invoke Pattern的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想点击仅调用模式的标签。我正在获取AutomationElement的调用模式,并且Invoke()方法也正在执行,但是在应用程序的选项卡上没有发生单击。这是我的代码片段:

I want to click on a tab which has invoke pattern only. I am getting the invoke pattern of the AutomationElement and Invoke() method is also getting executed but click is not happening on the tab of the application. Here is my code snippet :

 foreach (AutomationElement AE in serviceRequestTab)
                {
                    if (AE.Current.Name == "Notes")
                    {
                        InvokePattern ptrnServiceRequestTab = AE.GetCurrentPattern(InvokePattern.Pattern) as InvokePattern;
                        //System.Windows.Point pt= AE.GetClickablePoint();
                        if (ptrnServiceRequestTab != null)
                        {
                            ptrnServiceRequestTab.Invoke();
                            Thread.Sleep(4000);
                        }
                    }
                }

除了使用GetClickalblePoint()方法抛出异常:"元素没有任何可点击的点"。

Besides using GetClickalblePoint() method throws exception : "Element doesn't have any clickable point".

任何可以帮助我的人?​​

Anyone who can help me out?

推荐答案

如果您可以为选项卡检索SelectionItem模式,则可以使用Select。

If you can retrieve a SelectionItem pattern for the tab you can use Select.

如果您只有InvokePattern并且Invoke失败,请尝试获取LegacyIAccessiblePattern并调用它DoDefaultAction方法。

If you only have an InvokePattern and Invoke fails, try getting the LegacyIAccessiblePattern and calling it's DoDefaultAction method.


这篇关于UIAutomation单击使用AutomationElement的Invoke Pattern的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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