【问题标题】:Cannot get insides of the element from other app无法从其他应用程序获取元素的内部
【发布时间】:2021-04-19 08:31:58
【问题描述】:

我想找到带有文本的特定按钮(通过文本查找)并按下它。 我试图从 Teleramm 桌面应用程序的 'group'('группа' on screanshot) 元素中获取内部信息,我知道那里有明确的按钮列表,但我无法使用 UIA 和 inspect.exe 找到任何内容。我尝试了原始 automtaion dll 和 nuget UIAComWrapper。 SendMessage(获取文本)和 EnumChildWindows 也没有帮助我,因为 SendMessage 枚举不返回应用程序内的其他句柄。

AutomationElementCollection automation_element_collection = group_element.FindAll(TreeScope.Children, Condition.TrueCondition); //empty collection
AutomationElement automation_element_collection = group_element.FindFirst(TreeScope.Children, Condition.TrueCondition); //returns null
            
TreeWalker raw_view_walker = TreeWalker.RawViewWalker;
AutomationElement automation_element = raw_view_walker.GetFirstChild(group_element); //returns null

我做错了什么,是否有其他项目可以帮助我解决这个问题?

screanshot from inspector.exe

【问题讨论】:

    标签: c# windows ui-automation


    【解决方案1】:

    Telegram 桌面应用程序多年来不支持 UIA 等辅助功能,请查看 Github ticket。形式上,它可以工作,但在一个非常基本的层面上 - 没有检索消息历史文本内容、组和联系人姓名等的选项。

    因此,在实现任何这些之前,没有办法以编程方式遍历 UI 元素。但如果你真的需要它,你可以看看 OCR。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-04-30
      • 1970-01-01
      • 2014-02-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多