Why are those codes not working?

Jul 9, 2008 at 10:45 AM
Edited Jul 9, 2008 at 10:49 AM
I have an application which is written in WPF. When I run the application, there is main window called "MainWpfForm".  There is a menu on that form and if I click on that menu then it will show new window called "NewWpfForm". There is a textbox called txtCode on that forum.

I see the following structure when checking with UISpy,

window "MainWpf"
----window "NewWpfForm"
------------edit  -- AutomationId=txtCode   Name=""
----MenuBar


1)
                application = Application.Launch("Agilebet.Client.exe");
                window = application.GetWindow("Agile Bet Client", InitializeOption.NoCache);

                //Click Menu to open "NewWpfForm"
               Core.UIItems.WindowStripControls.MenuBar menuBar = window.MenuBar;
                menuBar.MenuItem("User Management", "Create Member").Click();

                Window newWpfForm = window.Get<Window>("NewWpfForm")    // This code doesn't work. Why?


2)   Why doesn't this code work?  (I wanna find all of window object.)

      SearchCriteria searchCriteria = SearchCriteria.ByAutomationId("").AndControlType(typeof(Window)).AndIndex(0);

3) Why doesn't this code work?

                application = Application.Launch("Agilebet.Client.exe");
                window = application.GetWindow("Agile Bet Client", InitializeOption.NoCache);

                //Click Menu to open "NewWpfForm"
               Core.UIItems.WindowStripControls.MenuBar menuBar = window.MenuBar;
                menuBar.MenuItem("User Management", "Create Member").Click();

                SearchCriteria sc = SearchCriteria.ByAutomationId("txtCode");
                window.Get<TextBox>(sc).BulkText = "Member 100";

Error Message: +        ex    {"Could not make the TextBox with AutomationId=txtCode and Name=<empty> visible, after waiting for 5000 ms"}    System.Exception {Core.UIItems.UIActionException}


I'm very new to this framework and any idea would be appriciated. Thanks. Awaiting your reply...


Coordinator
Jul 9, 2008 at 3:37 PM
1. You need to use window.ModalWindow to find a window launched by another window. Since a lot of people are stumbling here I need to do something about this so that the feedback about this is faster.
2. You can use Desktop.Instance to get all the windows on desktop. Although this would not provide descendant windows. Let me know if this works for you.
3. Does your window have a scrollbar because of which the window is not visible?
Jul 10, 2008 at 2:46 AM


viveksingh wrote:
1. You need to use window.ModalWindow to find a window launched by another window. Since a lot of people are stumbling here I need to do something about this so that the feedback about this is faster.

Great. That works. Thanks a lot..