window.Get throwing exception when accessing Name of existing control

Jul 22, 2009 at 10:23 PM
Edited Jul 22, 2009 at 10:26 PM

Guys, I am facing a problem when accessing a name of a control that was rendered a long time ago in my UI. The only thing that happened was a short time since it becomes enabled, and a click was made (another button was clicked)

I created this methods to avoid the error:

public static void WaitTillControlIsFound(this Window window, string controlName)
{

    window.WaitTill(

    () =>
    {
        IUIItem item = null;
        try
    {
        item = window.Get(SearchCriteria.ByAutomationId(controlName));
    }
    catch { }
        return item != null;
    });
}

I know it sucks, but it is the only way I could avoid the error.

StackTrace:
Repository.Interceptors.UIItemInterceptor.Intercept(IInvocation invocation) in d:\white\Repository\Interceptors\UIItemInterceptor.cs: line 36
Castle.DynamicProxy.AbstractInvocation.Proceed() in d:\OSS\Castle\Tools\Castle.DynamicProxy2\Castle.DynamicProxy\AbstractInvocation.cs: line 165
ButtonProxy421b6b31291f4880ab12538f75f99679.get_Name()


Thank you, Felipe Lopes

 

 

Coordinator
Sep 20, 2009 at 5:25 AM

For some reason I never saw this message, my apologies.

What makes your control enabled?