0

I have forms that contain controls in my application under test. These controls load data in their own threads.

I would like to add a block until the form is fully loaded.

How is this done?

JL.
  • 78,954
  • 126
  • 311
  • 459

1 Answers1

0

I think the cleanest way to do that is to listen to AsyncContentLoadedEvent.

An other way, which assumes you know which components needs to be loaded, is to search the UI Automation Tree for the AutomationElement(s) directly (FindAll, FindFirst, TreeWalker). If all AElements are available it means it's loaded. You could consider the childCount or various AutomationElementProperties to verify that. Of course several Patterns (e.g. ValuePattern) could be additionally used to verify the state of the AElements.

Alternativly to AsyncContentLoadedEvent, you could check out if your application uses some kind of UI Element for showing the current status of the loading process (HelpTextProperty, Icon, Label, etc..). In such case I would simple query this certain AElement for it's current value/name/.. (or also color (not directly supported by UI Automation and requires some workaround)). and wait until it has the required state

Haphil
  • 1,180
  • 1
  • 14
  • 33