skypeapp.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:wintenApps 作者: josephsl 项目源码 文件源码
def locateElement(self, automationID):
        # Foreground isn't reliable.
        fg = api.getForegroundObject()
        if fg.getChild(1).childCount > 0:
            screenContent = fg.getChild(1)
        else:
            screenContent = fg.getChild(2)
        # Thanks to My Peple in Fall Creators Update, screen content so far could actually be the title bar, and the actual foreground window is next door.
        # In other words, Skype window is embedded inside My People window.
        if screenContent.UIAElement.cachedAutomationID == "TitleBar":
            # The following traversal path may change in future builds.
            screenContent = screenContent.next.simpleLastChild.simpleFirstChild
        # Element placement (according to UIA changes from time to time.
        # Wish there is a more elegant way to do this...
        for element in screenContent.children:
            if isinstance(element, UIA) and element.UIAElement.cachedAutomationID == automationID:
                return element
        return None

    # Name change cache (yet again)
    # In some cases, Skype message fires name change, and a related element fires live region changed event.
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号