Search code examples
c#visual-studio-2019flaui

How to test with views and not windows in Visual Studio 2019 with FlaUI?


Is it possible to test views with FlaUI?

I have usercontrols with views and tabs on it and not windows. With windows you can do this:

Application.GetMainWindow

But how can I do that with views?


Solution

  • I found it!

    It takes a few seconds to start the application, so I added the following line:

    System.Threading.Thread.Sleep(4000)

    And if you want to find buttons/labels etc. You have to use this function:

    Window.FindFirstDescendant(cf => cf.ByAutomationId("MyButton"))?.AsButton()