Failed to locate opened application window with appId"xxx" and process "xxx"
HI
I am using the latest windows app driver(1.0) to test my company UWP application. When I try to execute my tests I continuously get the above error (mentioned in the subject line).
I tried the workaround wherein I create a desktop session and switch to the desktop window. But still I get the same error, it already been a day I am trying to debug the issue.
The windows 10 version that I am using is 16299.
Please help.
Appium dotnet driver version is 3.0.0.2
Hi @anunayaabb,
The first things you would need to identify are:
- The right main application window that you are targeting. This window should be launched by the first session creation command even though it may fail to locate it.
- The right attributes (
accessibility id,name, or others) of this particular main window that you can use the Desktop Session to locate this Window element. inspect.exe is useful for this purpose.
Once you collected this information, you can have the following sequence to start your session:
- Create a session based on the application identifier
- Since the application always succeed to launch but failed to be located, create a Desktop Session
- Locate the application window and create a new session by attaching to it as shown below: https://github.com/Microsoft/WinAppDriver/blob/v1.0/README.md#attaching-to-an-existing-app-window
Thanks Margo for the response. But how can I figure out what is accessibility id using inspect.exe , because i cant find any field as accessibility id in inspect.exe
Also inspect.exe shows a different PID and task manager shows different PID, I am struggling to figure out Appium driver takes which PID.
Hi @anunayaabb,
As shown in the Supported Locators table in our readme, accessibility id refers to AutomationId in inspect.exe.
The ProcessId shown in inspect.exe is the right process that own the application window/UI. In UWP case however, the main application window (Windows.UI.Core.CoreWindow) which has the right ProcessId associated to your session is generally hosted in an ApplicationFrameWindow that has a different ProcessId. In such case, you should only care about the process id of the main application window.
Try to include below capability which solved my issue of Failed to locate opened application window with appId"xxx" and process "xxx"
My exe file present in C:\Program Files\MT
appCapabilities.SetCapability("appWorkingDir", "C:\Program Files\MT");