question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot launch some tests for my UWP App. Error "Failed to locate opened application window with appId:"

See original GitHub issue

I have UWP app with loading page to start app (no splash). Some tests (not all), fail with this message “Failed to locate opened application window with appId:”. I tried several thing (update appium client to lastest version(7.4.1), put a ms:waitForAppLaunch capability and createSessionTimeout) and it’s not work.

This is my code in Java (my tests are in Junit):

public void setUp() throws Exception { DesiredCapabilities capabilities = new DesiredCapabilities(); capabilities.setCapability("app", "AppPackage!App"); windows = new WindowsDriver(new URL("http://127.0.0.1:4723"), capabilities); capabilities.setCapability("createSessionTimeout",600000); capabilities.setCapability("ms:waitForAppLaunch",50); windows.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS); Thread.sleep(120000); }

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
licanhuacommented, Dec 12, 2020

Please use inspect.exe to see the class of the loading page. WinAppDriver expects ApplicationFrameWindow or Windows.UI.Core.CoreWindow. If it’s not this window, likely you are not in the supported path.

There is no good workaround for this until an code change in WinAppDriver.

I didn’t do the testing, but a possible workaround is execution alias. which will fool the WinAppDriver to make it think it’s not an UWP app and launch it as a legacy application. Of course, there are still some rule in the legacy path. Your app may or may not launchable from WinAppDriver with ExecutionAlias.

<uap3:Extension Category="windows.appExecutionAlias" 
                Executable="DbgX.Shell.exe" 
                EntryPoint="Windows.FullTrustApplication">
  <uap3:AppExecutionAlias>
    <desktop:ExecutionAlias Alias="WinDbgX.exe" />
  </uap3:AppExecutionAlias>
</uap3:Extension>

If your app didn’t kill by WinAppDriver automatically when it failed, It’s possible to continue the testing. You can open another session with

appCapabilities.SetCapability("app", "Root");

Then do the testing in ‘desktop’. Of course, ‘root’ includes all process, so you need to filter other processes by yourself.

0reactions
leticiafercommented, Jan 20, 2021

Thanks, but it cannot fix my problem. Because, I need a timeout from WinAppDriver. No catch a windows.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Failed to locate opened application window with appId: C:\ ...
Hi,. I am trying to evalate Katalon Studio and in my first attempt to record Windows action got error on calc.exe (notepad.exe works):....
Read more >
WinAppDriver for WPF application failed creating ...
I am not able to run a test for a WPF desktop application. It fails most of times when I create the Session...
Read more >
UI testing for Windows apps with WinAppDriver and Appium
The full application must be up & running, while unit testing ... WebDriverException: Failed to locate opened application window with appId: ...
Read more >
appium-windows-driver
Start using appium-windows-driver in your project by running `npm i ... of UWP applications (aka Failed to locate opened application window ...
Read more >
What application types are supported by winappdriver
Winappdriver can start executables (generally .exe files on Windows). I suspect your .msc file is a management saved console?
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found