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.56k stars 485 forks source link

"Parameter is incorrect" `COMError` with `ControlFromCursor` function #238

Open cmin764 opened 1 year ago

cmin764 commented 1 year ago

This error happens when you retrieve elements with ControlFromPoint:

    control = auto.ControlFromCursor()
  File "Z:\Repos\rpaframework\packages\windows\.venv\lib\site-packages\uiautomation\uiautomation.py", line 8190, in ControlFromCursor
    return ControlFromPoint(x, y)
  File "Z:\Repos\rpaframework\packages\windows\.venv\lib\site-packages\uiautomation\uiautomation.py", line 8168, in ControlFromPoint
    element = _AutomationClient.instance().IUIAutomation.ElementFromPoint(ctypes.wintypes.POINT(x, y))
_ctypes.COMError: (-2147024809, 'The parameter is incorrect.', (None, None, None, 0, None))

in the following scenarios (where by point I mean retrieving the element at cursor's position):

  1. Point Calculator display, then its title bar.
  2. Point in Chrome and then its address bar or Desktop.
  3. Point inside the latest Notepad and then point to its title bar.
Screenshot_2023-03-01_at_17_14_30

OS: Windows 11 ARM (insider preview) on Mac M1 through Parallels.

Edition Windows 11 Pro Insider Preview
Version 22H2
Installed on    ‎23/‎02/‎2023
OS build    25300.1000
Experience  Windows Feature Experience Pack 1000.25300.1000.0
yinkaisheng commented 1 year ago

Sorry, I don't have an ARM Windows, I can't reproduce the issue.