UI Automation with White run-time error when finding childs

Jun 25, 2013 at 1:59 PM
For some reason I am getting a run-time error from White.Core when trying to locate a Window child from its parent.

ERROR DISPLAYED:
White.Core.Mappings.ControlDictionaryException: Could not find TestControl for ControlType=window and FrameworkId:Win32
at White.Core.Mappings.ControlDictionary.GetTestControlType(ControlType controlType, String frameWorkId, Boolean isNativeControl)
at White.Core.Mappings.ControlDictionary.GetTestType(String className, ControlType controlType, String frameworkId, String name, Boolean isNativeControl)
at White.Core.Mappings.ControlDictionary.GetTestType(AutomationElement automationElement)
at White.Core.Factory.DictionaryMappedItemFactory.Create(AutomationElement automationElement, ActionListener actionListener)
at White.Core.Factory.DictionaryMappedItemFactory.Create(AutomationElement automationElement, ActionListener actionListener, Type customItemType)
at White.Core.Factory.PrimaryUIItemFactory.Create(SearchCriteria searchCriteria, ActionListener actionListener)
at White.Core.UIItems.Container.NonCachedContainerItemFactory.Find(SearchCriteria searchCriteria)
at White.Core.UIItems.Container.ContainerItemFactory.Get(SearchCriteria searchCriteria, ActionListener uiItemActionListener)
at White.Core.Sessions.NullWindowSession.Get(ContainerItemFactory containerItemFactory, SearchCriteria searchCriteria, ActionListener actionListener)
at White.Core.UIItems.Container.CurrentContainerItemFactory.Find(SearchCriteria searchCriteria, WindowSession windowSession)
at White.Core.UIItems.UIItemContainer.Get(SearchCriteria searchCriteria)
--- End of inner exception stack trace ---
at White.Core.UIItems.UIItemContainer.Get(SearchCriteria searchCriteria)
at ICOWrapper.Form1.wasUserLoggedIn(String id1, String id2)
at ICOWrapper.Form1.button2_Click(Object sender, EventArgs e)
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

The current structure that I am trying to navigate is the following:

Main Window->Panel->Window

and I am using the following method in C#
        public Boolean wasUserLoggedIn(string id1, string id2)
    {
        Thread.Sleep(500);
        var mdiClient = window.MdiChild(SearchCriteria.ByControlType(ControlType.Pane).AndAutomationId(id1));
        Thread.Sleep(500);
        var selectPatient = (Window)mdiClient.Get(SearchCriteria.ByControlType(ControlType.Window).AndAutomationId(id2));
        Thread.Sleep(500);
        return selectPatient != null? true: false;
    }
and calling the method as follow:
Boolean wasFound = wasUserLoggedIn("40960", "40961");
UIspy objects used for identify ControlType and AutomationID:

AutomationId: 40960
ControlType: ControlType.Pane
Name:
HelpText:
Bounding rectangle: 8,78,900,581
ClassName: MDIClient
IsOffScreen: False
FrameworkId: Win32
ProcessId: 5964


AutomationId: 40961
ControlType: ControlType.Window
Name: Home
HelpText:
Bounding rectangle: 8,59,900,600
ClassName: ClaWin01000000H_2
IsOffScreen: False
FrameworkId: Win32
ProcessId: 5964
Coordinator
Jun 26, 2013 at 11:40 AM
White has moved to https://github.com/TestStack/White and is now under the TestStack banner, could you try upgrading to TestStack.White (from NuGet) and see if that fixes your issue.

If not, don't supposed you could give me a small test application and the test code to replicate the issue? Also, could you post this issue on GitHub, as I get email notifications for CodePlex, but I am not actively fixing issues which are listed on codeplex.

Cheers,
Jake
Jun 26, 2013 at 1:57 PM
Thanks Jake, I will install the new TestStack.White and I will let you know how it goes.


I really appreciate it,


-Carlos



Sep 20, 2013 at 10:38 PM
Hi -

Were you able to get any kind of resolution on this issue?

I am running into the same issue using the latest version from Nuget.

Thanks
Coordinator
Sep 21, 2013 at 8:12 AM
If this is still an issue, could you please open an issue on GitHub. I am not tracking issues on Codeplex
Sep 23, 2013 at 6:52 PM