WinAppDriver icon indicating copy to clipboard operation
WinAppDriver copied to clipboard

Failed to locate opened application window with appId"xxx" and process "xxx"

Open anunayaabb opened this issue 8 years ago • 6 comments

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.

anunayaabb avatar Dec 12 '17 08:12 anunayaabb

Appium dotnet driver version is 3.0.0.2

anunayaabb avatar Dec 12 '17 10:12 anunayaabb

Hi @anunayaabb,

The first things you would need to identify are:

  1. 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.
  2. 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:

  1. Create a session based on the application identifier
  2. Since the application always succeed to launch but failed to be located, create a Desktop Session
  3. 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

timotiusmargo avatar Dec 12 '17 22:12 timotiusmargo

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

anunayaabb avatar Dec 13 '17 06:12 anunayaabb

Also inspect.exe shows a different PID and task manager shows different PID, I am struggling to figure out Appium driver takes which PID.

anunayaabb avatar Dec 13 '17 06:12 anunayaabb

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.

timotiusmargo avatar Dec 16 '17 01:12 timotiusmargo

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");

balaji-githubstore avatar Oct 12 '20 09:10 balaji-githubstore