Coded UI for WinForms - find main window programmaticallyUnit Tests in Visual Studio 2010Running Coded UI tests with Resharper/NUnit will not locate Silverlight componentsNot able to recognize MSAA controlsVS2013 coded ui test fails at playback when trying to click on sub menu itemsCodedUI exception: UITestControlNotFoundException: Addional Details: TechnologyName: 'MSAA' ControlType: 'MenuItem' Name: 'All'Why isn't the Mouse.DoubleClick functioning properly when the Coded UI test is executed via MTM?Coded UI test click throws hidden control exception in windows 10 but works on windows 7coded user interface test not same behavior on different PCFinding TextBox inside of UserControlCoded UI is identifying the control but not performing any action

Is it possible to kill all life on Earth?

Why is Colorado so different politically from nearby states?

How can a single Member of the House block a Congressional bill?

Is it OK to bring delicacies from hometown as tokens of gratitude for an out-of-town interview?

Why does my electric oven present the option of 40A and 50A breakers?

Do I add my ability modifier to the damage of the bonus-action attack granted by the Crossbow Expert feat?

Humans meet a distant alien species. How do they standardize? - Units of Measure

What if you don't bring your credit card or debit for incidentals?

Imperfective Aspect in German "not since" constructions

What is the correct expression of 10/20, 20/30, 30/40 etc?

How can Iron Man's suit withstand this?

Can a magnetic field of a large body be stronger than its gravity?

Is it legal in the UK for politicians to lie to the public for political gain?

Is the capacitor drawn or wired wrongly?

How can I offer a test ride while selling a bike?

How did rebel fighters get past the Scarif shield?

Opposite of "Squeaky wheel gets the grease"

Strange math syntax in old basic listing

Unconventional Opposites

How should I push back against my job assigning "homework"?

Does any lore text explain why the planes of Acheron, Gehenna, and Carceri are the alignment they are?

How do I get a cleat that's stuck in a pedal, detached from the shoe, out?

Where do the UpdateInstallationWizard.aspx logs get saved in Azure PaaS?

GFCI Outlet in Bathroom, Lights not working



Coded UI for WinForms - find main window programmatically


Unit Tests in Visual Studio 2010Running Coded UI tests with Resharper/NUnit will not locate Silverlight componentsNot able to recognize MSAA controlsVS2013 coded ui test fails at playback when trying to click on sub menu itemsCodedUI exception: UITestControlNotFoundException: Addional Details: TechnologyName: 'MSAA' ControlType: 'MenuItem' Name: 'All'Why isn't the Mouse.DoubleClick functioning properly when the Coded UI test is executed via MTM?Coded UI test click throws hidden control exception in windows 10 but works on windows 7coded user interface test not same behavior on different PCFinding TextBox inside of UserControlCoded UI is identifying the control but not performing any action






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















I am working on a coded ui project for a win forms application. I would like to get the main window of the application under test programmatically.



What I tried is:



WinWindow mainWindow = new WinWindow();
mainWindow.TechnologyName = "MSAA";
main.Window.SearchProperties.Add(new PropertyExpression(WinWindow.PropertyNames.Name, "Soft under test", PropertyExpressionOperator.Contains));
mainWindow.SearchProperties.Add(new PropertyExpression(WinWindow.PropertyNames.ClassName, "WindowsForms10.Window", PropertyExpressionOperator.Contains));
mainWindow.SearchConfigurations.Remove(SearchConfiguration.VisibleOnly);
mainWindow.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch);


This fails with:



The playback failed to find the control with the given search properties. Additional Details:
TechnologyName: 'MSAA'
Name: 'Soft under test'
ClassName: 'WindowsForms10.Window'
---> System.Runtime.InteropServices.COMException: Error HRESULT E_FAIL has been returned from a call to a COM component.



What is the correct way to get the window?










share|improve this question

















  • 1





    Let the Coded UI record and generate tool show you. Make a recording, possibly into a sandbox project, and then copy the useful bits.

    – AdrianHHH
    Mar 24 at 14:35











  • Also, performance wise, try using the least amount of search properties to find the control you are looking for. The coded ui test recorder lets you do that.

    – PixelPlex
    Mar 25 at 8:12

















0















I am working on a coded ui project for a win forms application. I would like to get the main window of the application under test programmatically.



What I tried is:



WinWindow mainWindow = new WinWindow();
mainWindow.TechnologyName = "MSAA";
main.Window.SearchProperties.Add(new PropertyExpression(WinWindow.PropertyNames.Name, "Soft under test", PropertyExpressionOperator.Contains));
mainWindow.SearchProperties.Add(new PropertyExpression(WinWindow.PropertyNames.ClassName, "WindowsForms10.Window", PropertyExpressionOperator.Contains));
mainWindow.SearchConfigurations.Remove(SearchConfiguration.VisibleOnly);
mainWindow.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch);


This fails with:



The playback failed to find the control with the given search properties. Additional Details:
TechnologyName: 'MSAA'
Name: 'Soft under test'
ClassName: 'WindowsForms10.Window'
---> System.Runtime.InteropServices.COMException: Error HRESULT E_FAIL has been returned from a call to a COM component.



What is the correct way to get the window?










share|improve this question

















  • 1





    Let the Coded UI record and generate tool show you. Make a recording, possibly into a sandbox project, and then copy the useful bits.

    – AdrianHHH
    Mar 24 at 14:35











  • Also, performance wise, try using the least amount of search properties to find the control you are looking for. The coded ui test recorder lets you do that.

    – PixelPlex
    Mar 25 at 8:12













0












0








0








I am working on a coded ui project for a win forms application. I would like to get the main window of the application under test programmatically.



What I tried is:



WinWindow mainWindow = new WinWindow();
mainWindow.TechnologyName = "MSAA";
main.Window.SearchProperties.Add(new PropertyExpression(WinWindow.PropertyNames.Name, "Soft under test", PropertyExpressionOperator.Contains));
mainWindow.SearchProperties.Add(new PropertyExpression(WinWindow.PropertyNames.ClassName, "WindowsForms10.Window", PropertyExpressionOperator.Contains));
mainWindow.SearchConfigurations.Remove(SearchConfiguration.VisibleOnly);
mainWindow.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch);


This fails with:



The playback failed to find the control with the given search properties. Additional Details:
TechnologyName: 'MSAA'
Name: 'Soft under test'
ClassName: 'WindowsForms10.Window'
---> System.Runtime.InteropServices.COMException: Error HRESULT E_FAIL has been returned from a call to a COM component.



What is the correct way to get the window?










share|improve this question














I am working on a coded ui project for a win forms application. I would like to get the main window of the application under test programmatically.



What I tried is:



WinWindow mainWindow = new WinWindow();
mainWindow.TechnologyName = "MSAA";
main.Window.SearchProperties.Add(new PropertyExpression(WinWindow.PropertyNames.Name, "Soft under test", PropertyExpressionOperator.Contains));
mainWindow.SearchProperties.Add(new PropertyExpression(WinWindow.PropertyNames.ClassName, "WindowsForms10.Window", PropertyExpressionOperator.Contains));
mainWindow.SearchConfigurations.Remove(SearchConfiguration.VisibleOnly);
mainWindow.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch);


This fails with:



The playback failed to find the control with the given search properties. Additional Details:
TechnologyName: 'MSAA'
Name: 'Soft under test'
ClassName: 'WindowsForms10.Window'
---> System.Runtime.InteropServices.COMException: Error HRESULT E_FAIL has been returned from a call to a COM component.



What is the correct way to get the window?







winforms coded-ui-tests






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 24 at 12:22









CristisSCristisS

7241622




7241622







  • 1





    Let the Coded UI record and generate tool show you. Make a recording, possibly into a sandbox project, and then copy the useful bits.

    – AdrianHHH
    Mar 24 at 14:35











  • Also, performance wise, try using the least amount of search properties to find the control you are looking for. The coded ui test recorder lets you do that.

    – PixelPlex
    Mar 25 at 8:12












  • 1





    Let the Coded UI record and generate tool show you. Make a recording, possibly into a sandbox project, and then copy the useful bits.

    – AdrianHHH
    Mar 24 at 14:35











  • Also, performance wise, try using the least amount of search properties to find the control you are looking for. The coded ui test recorder lets you do that.

    – PixelPlex
    Mar 25 at 8:12







1




1





Let the Coded UI record and generate tool show you. Make a recording, possibly into a sandbox project, and then copy the useful bits.

– AdrianHHH
Mar 24 at 14:35





Let the Coded UI record and generate tool show you. Make a recording, possibly into a sandbox project, and then copy the useful bits.

– AdrianHHH
Mar 24 at 14:35













Also, performance wise, try using the least amount of search properties to find the control you are looking for. The coded ui test recorder lets you do that.

– PixelPlex
Mar 25 at 8:12





Also, performance wise, try using the least amount of search properties to find the control you are looking for. The coded ui test recorder lets you do that.

– PixelPlex
Mar 25 at 8:12












1 Answer
1






active

oldest

votes


















0














Not sure if this question is still relevant, but here is the code I use to get the window:



this.TechnologyName = "MSAA";
this.SearchProperties.Add(UITestControl.PropertyNames.Name, "MyProgram");
this.SearchProperties.Add(UITestControl.PropertyNames.ControlType, "Window");
this.SearchProperties.Add("ControlName", "TopScreen");
this.SearchConfigurations.Add(SearchConfiguration.ExpandWhileSearching);


Perhaps, you need ExpandWhileSearching property for it to find the screen.






share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55323748%2fcoded-ui-for-winforms-find-main-window-programmatically%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    Not sure if this question is still relevant, but here is the code I use to get the window:



    this.TechnologyName = "MSAA";
    this.SearchProperties.Add(UITestControl.PropertyNames.Name, "MyProgram");
    this.SearchProperties.Add(UITestControl.PropertyNames.ControlType, "Window");
    this.SearchProperties.Add("ControlName", "TopScreen");
    this.SearchConfigurations.Add(SearchConfiguration.ExpandWhileSearching);


    Perhaps, you need ExpandWhileSearching property for it to find the screen.






    share|improve this answer



























      0














      Not sure if this question is still relevant, but here is the code I use to get the window:



      this.TechnologyName = "MSAA";
      this.SearchProperties.Add(UITestControl.PropertyNames.Name, "MyProgram");
      this.SearchProperties.Add(UITestControl.PropertyNames.ControlType, "Window");
      this.SearchProperties.Add("ControlName", "TopScreen");
      this.SearchConfigurations.Add(SearchConfiguration.ExpandWhileSearching);


      Perhaps, you need ExpandWhileSearching property for it to find the screen.






      share|improve this answer

























        0












        0








        0







        Not sure if this question is still relevant, but here is the code I use to get the window:



        this.TechnologyName = "MSAA";
        this.SearchProperties.Add(UITestControl.PropertyNames.Name, "MyProgram");
        this.SearchProperties.Add(UITestControl.PropertyNames.ControlType, "Window");
        this.SearchProperties.Add("ControlName", "TopScreen");
        this.SearchConfigurations.Add(SearchConfiguration.ExpandWhileSearching);


        Perhaps, you need ExpandWhileSearching property for it to find the screen.






        share|improve this answer













        Not sure if this question is still relevant, but here is the code I use to get the window:



        this.TechnologyName = "MSAA";
        this.SearchProperties.Add(UITestControl.PropertyNames.Name, "MyProgram");
        this.SearchProperties.Add(UITestControl.PropertyNames.ControlType, "Window");
        this.SearchProperties.Add("ControlName", "TopScreen");
        this.SearchConfigurations.Add(SearchConfiguration.ExpandWhileSearching);


        Perhaps, you need ExpandWhileSearching property for it to find the screen.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered May 24 at 13:57









        Ivan BIvan B

        438




        438





























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55323748%2fcoded-ui-for-winforms-find-main-window-programmatically%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

            SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

            은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현