UI tests are getting failed if the wpf is running behind any other window or application
While running the test using WinAppDriver , if the wpf app is running behind any other windows application, the WinAppDriver failed to identify the window elements, so as a result the tests are failing. So I need to cautious to close or minimise all other application before running the test and Visual studio should be minimised or reduce its window size.
Anyone got any suggestion or fixes to handle this problem ?
Environment Using: Visual Studio Online 2019, Dell Studio laptop with Windows 10 Enterprise Operating system, Windows Application Driver listening for requests at: http://127.0.0.1:4723/, Inspect.exe running from following path > C:\Program Files (x86)\Windows Kits\10\bin\10.0.17763.0\x86 Azus monitor hooked up to laptop via HDMI.
This is by design and how WinAppDriver interacts with the Windows 10 UI.
@hassanuz are you saying that the window is supposed to start behind all other windows? Because that's the behavior I'm seeing when running tests from visual studio. The target application will start, but it's behind all other windows.
Is there a way to force the window to the foreground?
I am seeing this same behavior. With MDI forms my open window will jump from the foreground to the background for no reason. This only happens when I am using WinAppDriver. Is there a way to bring the window to the foreground?
@cgetty12 The workaround I found was to click on the taskbar and leave the mouse there before WinAppDriver opens the window.
YMMV but it works for me consistently 🤷♂️
Thanks @dquist. What I am experiencing is the window jumps to the background when I am interacting with it. The MDI child form will jump behind the main application MDI window. I can't go to the taskbar after every interaction to bring the window back to the front.