yinkaisheng / Python-UIAutomation-for-Windows

🐍Python 3 wrapper of Microsoft UIAutomation. Support UIAutomation for MFC, WindowsForm, WPF, Modern UI(Metro UI), Qt, IE, Firefox, Chrome ...
Apache License 2.0
2.3k stars 462 forks source link

Suggestion - comtypes UIAutomationCode.dll #267

Open coffeelover1010 opened 5 months ago

coffeelover1010 commented 5 months ago

Hi,

Thank you for the project, I found it very useful.

I would like to share some code with you in case you find it useful:


import comtypes.client
from comtypes import CLSCTX_ALL

class MyAutomationExample:
    UIAutomationCore = comtypes.client.GetModule("UIAutomationCore.dll")
    IUIAutomation = comtypes.CoCreateInstance(
        UIAutomationCore.CUIAutomation._reg_clsid_,
        interface=UIAutomationCore.IUIAutomation,
        clsctx=CLSCTX_ALL
        )
    def __init__(self):
        MyAutomationExample.UIAutomationCore
        MyAutomationExample.IUIAutomation

MyAutomationExample.UIAutomationCore
MyAutomationExample.IUIAutomation
my_automation_example = MyAutomationExample()
my_automation_example.UIAutomationCore
my_automation_example.IUIAutomation