InvokePattern.Invoke()不起作用 [英] InvokePattern.Invoke() doesn't work

查看:173
本文介绍了InvokePattern.Invoke()不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的代码

  
                    AutomationElementCollection btns = grid.FindAll(TreeScope.Descendants,
               b新的System.Windows.Automation.PropertyCondition(AutomationElement.AutomationIdProperty,"btnDelete")));
                   如果(btns .Count< = 0)
               b Assert.Fail(按钮不可见");
                    IEnumerator myEnum = btns .GetEnumerator();
                    while(myEnum.MoveNext())
                    { ;              b ;
               b AutomationElement btn =(AutomationElement)myEnum.Current;
               b InvokePattern ip =(InvokePattern)btn.GetCurrentPattern(InvokePattern.Pattern);
               b ip.Invoke();
                    }

  
                    AutomationElementCollection btns = grid.FindAll(TreeScope.Descendants,
                        new System.Windows.Automation.PropertyCondition(AutomationElement.AutomationIdProperty, "btnDelete"));
                    if (btns .Count <=0)
                        Assert.Fail("Button is not visible");
                    IEnumerator myEnum = btns .GetEnumerator();
                    while (myEnum.MoveNext())
                    {                                                  
                        AutomationElement btn = (AutomationElement) myEnum.Current;
                        InvokePattern ip = (InvokePattern)btn.GetCurrentPattern(InvokePattern.Pattern);
                        ip.Invoke();
                    }

该代码不会引发错误,但也不起作用.

The code doesn't throw an error but it doesn't work either.

此代码正在测试网格.每行的第一列都有一个按钮.当您单击按钮时,它将删除当前行.

This code is testing a grid.  The first column of each row has a button. When you click the button it deletes the current row.

我在立即窗口中查看了集合中的每个项目,并执行了GetSupportedPatterns()方法,ProgrammaticName为"InvokePatternIdentifiers.Pattern,不是InvokePattern,不确定但想知道这是否有意义."这 其他模式被命名为同步".

I looked at each item in the collection in the immediate window and executed the GetSupportedPatterns() method and the ProgrammaticName is "InvokePatternIdentifiers.Pattern not InvokePattern, not sure but am wondering if this is significant.  The other pattern was named something synchronized.

有什么想法吗?

 

 

 

推荐答案

Hi

请将此问题发布在 http://social.msdn.microsoft.com/Forums/zh-CN/windowsaccessibilityandautomation/threads .

Please post this question on http://social.msdn.microsoft.com/Forums/en-US/windowsaccessibilityandautomation/threads.

谢谢

悉达多


这篇关于InvokePattern.Invoke()不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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