使用UI Automation实现自动化测试4.2 (ExpandCollapsePattern)

ExpandCollapsePattern

表示以可视方式进行展开(以显示内容)和折叠(以隐藏内容)的控件。例如ComboBox控件支持ExpandCollapsePattern

ExpandCollapsePattern有两个主要方法:

Expand()方法:隐藏 AutomationElement 的全部子代节点、控件或内容。

Collapse()方法:显示 AutomationElement 的全部子节点、控件或内容。

      以下代码是用ExpandCollapsePattern来测试ComboBox控件的Expand和Collapse。
Code
      以下代码为被测程序的xaml文件:
Code
Summary

本文主要是对ExpandCollapsePattern 做简单的介绍,并使用ExpandCollapsePattern来操作ComboBox控件,对ComboBox进行ExpandCollapse操作。


原文地址:https://www.cnblogs.com/kangyi/p/1565774.html