相关疑难解决方法(0)

UISpy.exe和Inspect.exe有什么区别?(来自Microsoft Windows SDK)

我真的想知道,Inspect.exe如何获取它的UI元素,因为它获得的元素比UISpy多得多(两者都在Microsoft Windows SDK 7中可用)

1)我认为UISpy通过UIAutomation库获取它的元素,对吗?(尝试使用UIAutomation并获得完全相同的元素,显示UISpy)

2)Inspect.exe使用哪个库?因为它显示了一些带有MacromediaFlashPlayerActiveX的应用程序的UI元素,我需要在自己的UI-Automation-Application中获取,希望有人知道它.

编辑:Inspect也有一个"UI自动化"模式,它是否也使用UIAutomation库?关于它的奇怪之处在于,在Inspect中它还显示了比UISpy更多的元素.

先感谢您

.net ui-automation ui-spy microsoft-ui-automation inspect.exe

11
推荐指数
1
解决办法
9547
查看次数

如何判断元素是否与Microsoft UI Automation中的PropertyCondition匹配?

我正在尝试在GridView的特定行中找到一个AutomationElement(因此有许多相同的元素).我正在迭代行中的元素,我想使用匹配器来查看特定元素是否与我传递给它的条件匹配.我从简单的PropertyConditions开始.

这是我的测试:

[TestFixture]
public class ConditionMatcherBehaviour
{
    [Test]
    public void ShouldMatchAPropertyConditionByItsValue()
    {
        var conditionMatcher = new ConditionMatcher();
        var condition = new PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.Pane);
        Assert.True(conditionMatcher.Matches(AutomationElement.RootElement, condition));
    }
}
Run Code Online (Sandbox Code Playgroud)

这是代码:

public class ConditionMatcher : IMatchConditions
{
    public bool Matches(AutomationElement element, Condition condition)
    {
        var propertyCondition = (PropertyCondition) condition;
        return propertyCondition.Value.Equals(element.GetCurrentPropertyValue(propertyCondition.Property));
    }
}
Run Code Online (Sandbox Code Playgroud)

不幸的是测试失败了.根元素(桌面)的ControlType确实是ControlType.Pane,但奇怪的是PropertyCondition.Value是"50033".

关于如何在FindFirst/FindAll之外测试PropertyCondition的任何想法?

(我的解决方法是创建我自己的条件类型并测试相反,但我想检查我是不是误解了某些东西/做了一些愚蠢的事情.)

c# wpf ui-automation

5
推荐指数
1
解决办法
2366
查看次数