koalich
koalich

Reputation: 1

Test method threw exception: Couldn't find window with title Calculator

I have one problem for each UI test on my computer:Test method threw exception: Couldn't find window with title Calculator. Of course, window is present and its name is "Calculator"(checked by inspect). The same situation is for others UI elements.

    using Microsoft.VisualStudio.TestTools.UnitTesting;
    using TestStack.White;
    using TestStack.White.Factory;
    using TestStack.White.UIItems;

    namespace UnitTestProject3
    {
        [TestClass]
        public class UnitTest1
        {
            [TestMethod]
            public void TestMethod1()
            {
                using (var application = Application.Launch("Calc.exe"))
                {
                    var calculator = application.GetWindow("Calculator", InitializeOption.NoCache);

                    // do something with the application
                    var b7 = calculator.Get<Button>(TestStack.White.UIItems.Finders.SearchCriteria.ByText("7"));
                    b7.Click();

                    application.Close();

                }
            }
        }
    }

What could it be?

Thanks in advance for your help.

Upvotes: 0

Views: 230

Answers (1)

stamhaney
stamhaney

Reputation: 1314

Teststack White does not support UWP applications such as Calculator on Windows 10. For supporting UWP apps, you can use:

  1. UIAComWrapper branch from white (partially working)
  2. Switch to UIA3

More information here

Upvotes: 1

Related Questions