MaxSearchDepth
Limit the maximum search depth for Automation Controls. Default value is 3.
int MaxSearchDepth;
Remarks
Searching in the tree of Automation Controls is a CPU intensive process and can introduce significant delays. Limiting the search depth will reduce this overhead. The default value is 3. Note that this only applies to searching for AutomationControl objects not Control objects.
Where a screen element can also be a Control (i.e. it has a unique window handle) then you can search for the element using the efficient Control Find methods and convert the result using the ToAutomationControl method.
Example
int currentSearchDepth = MaxSearchDepth; // save the current value
MaxSearchDepth = 5;
...
MaxSearchDepth = currentSearchDepth; // restore value
Related: