0

I am working on UI test automation and have noticed that usually AutomationElement.FromHandle is quite fast, but occasionally it takes 30 seconds to return an AutomationElement. From my limited logging it either takes less than 100ms or a full 30 seconds to get an AutomationElement back. Has anyone else seen this type of issue?

I admit that I have not done much investigation on the repeat-ability of this issue, so I don't know if there is potentially a performance issue with a control class in the application under test.

tmoltzan
  • 371
  • 1
  • 3
  • 6

1 Answers1

2

Don't know if this will help, but: when you use FromHandle, behind the scenes, UIAutomation is sending a WM_GETOBJECT message to the target window, using SendMessageTimeout or similar. If the target UI is frozen or busy doing something else, SendMessageTimeout will block until the timeout happens; this could be one cause of an intermittent block. You could check if this is the cause by also using SendMessageTimeout to send WM_NULL to the same HWND to 'ping' it, and if that also blocks, then you know that the problem is that the target UI is busy/hung then.

BrendanMcK
  • 14,252
  • 45
  • 54