我正在尝试使用以下代码滚动第三方.net应用程序中的滚动条。当我在visual studio中运行代码时,它会抛出访问冲突。当我在visual studio之外执行程序集时,它会显示Unsupported Pattern ....任何想法都非常感激=]
if(child.Current.ClassName == "ScrollBar")
{
PropertyCondition condition = new PropertyCondition(AutomationElement.AutomationIdProperty, child.Current.AutomationId);
AutomationElement btnElement = child.FindFirst(TreeScope.Element, condition);
ScrollPattern btnPattern = btnElement.GetCurrentPattern(ScrollPattern.Pattern) as ScrollPattern;
btnPattern.ScrollVertical(ScrollAmount.LargeIncrement);
}
答案 0 :(得分:2)
我几乎没有检查过: