为什么我无法在我的设置中单击此可选选项
本文关键字:单击 选项 设置 我的 为什么 | 更新日期: 2023-09-27 18:33:19
http://puu.sh/mVDoM/069787ca8d.png
我正在使用白色测试堆栈,我尝试使用:
ListViewRow presetter = p7window.Get<ListViewRow>(SearchCriteria.ByText("Presetter"));
presetter.Click();
TableRow presetter = p7window.Get<TableRow>(SearchCriteria.ByText("Presetter"));
presetter.Click();
ListItem presetter = p7window.Get<ListItem>(SearchCriteria.ByText("Presetter"));
presetter.Click();
我还尝试对参数中的字符串使用"名称行 1"和"行 1"。
当您指定并调用它以按文本查找时,它表示的是"text"属性,而不是它可能包含具有该值的文本。TableRow通常没有文本属性,而是使用诸如"Value"RowIndex"等内容。
此外,您应该知道元素在树中的位置,您可能必须将其传递给父控件。
即
List list = p7window.Get<List>(SearchCriteria.ByValue("Presetter"));
ListItem li = list.Get<ListItem>(SearchCriteria.ByValue("Presetter"));
尝试获取 AutomationElement。
***.GetElement(SearchCriteria.ByText("Presetter"));
如果它不为空,则通过getClicablePoint()找到一个点,然后像Mouse.Instance.Click()一样通过鼠标执行单击。
如果任何 SearachCriteria 都无法访问该元素 - 请尝试使用本机 MS UI 自动化:
- 获取离你最近的根控件。
- 从中获取自动元素属性。
- 查找它的整个子列表,例如 AutomationElement.FindAll(Treescrope.Descendals, PropertyCondition.TrueCondion) _
- 在自动元素数组中通过您需要的任何属性查找您的元素。
- 从中获取调用模式并使用 Invoke()