3

I am automating an application with python using the uiautomation library. En python 3.6.8

I can access any element of the application without problems when I use the method

control = auto.ControlFromCursor ()
print (control.AutomationId, control.Name)

but when I try to create the element based on its properties, the application breaks

control = auto.Control(AutomationId=id_, Name=name, ClassName=cls_name)

even if I do this it fails

control = auto.ControlFromCursor ()
print (control.AutomationId, control.Name)
id_ = control.AutomationId
name = control.Name
cls_name = control.ClassName 
control = auto.Control(AutomationId=id_, Name=name, ClassName=cls_name)

I found this, from Microsoft but I don't know where to find those hotfixes or what I should do. Any ideas? :/

https://support.microsoft.com/en-us/topic/applications-crash-when-automated-by-a-ui-automation-client-app-in-windows-b746d17a-fda1-a1a2-9290-431fa155e859

This is the error

enter image description here

Danilo Toro
  • 569
  • 2
  • 15
  • 1
    You're using [this library](https://github.com/yinkaisheng/Python-UIAutomation-for-Windows)? Did you read the part `Do not use 3.7.6 and 3.8.1, comtypes doesn't work in these two versions. Install an earlier version or the latest version.`? Are you sure your Python version isn't one of those? It'd be helpful if you shared your Python version. – Random Davis Feb 18 '21 at 20:24
  • @RandomDavis, Yes, I use that library. I use python 3.6.8. I have not had problems with the lib, I have automated about 10 different applications but with this application it fails :( – Danilo Toro Feb 18 '21 at 20:27
  • 1
    Well if nobody can figure out or solve the issue, then maybe you'll have to use another library, like [PyAutoGUI](https://pypi.org/project/PyAutoGUI/). – Random Davis Feb 18 '21 at 20:39
  • 1
    What version of Windows are you using? The hotfixes in question are only for Windows 8/Server 2012, which is long out of support. – Eric Brown Apr 01 '21 at 00:01

0 Answers0