Unable to create a new remote session

I’m just starting to explore Cycle to test native Windows apps. As suggested in the manuals I installed WinAppDriver and Accessibility Insigths for Windows. System is in Developer Mode and Cycle is started as administrator.

I wrote a little test case to use Windows Calculator.

Feature: Calc

Scenario: Calc1

Given I open app “xxx” at “C:\Windows\System32\calc.exe”

If I see object “name:8” in app within 5 seconds
Then I click object “name:8” in app within 2 seconds
And I click object “name:Add” in app within 2 seconds
And I click object “name:3” in app within 2 seconds
And I click object “name:Equals” in app within 2 seconds
And I wait 5 seconds
And I close app
Endif

The step Given I open app opens Calculator, but then fails with the error message:
Unable to create a new remote session.

When I replace the Given I open app with Given I connect to app … and I start Calculator by hand, prior to starting the test case, the test case runs without any problem.

Why does the I open app opens the app but is not able to connect to it?

Kind regards,
Henk.

Henk,

You’ve stumbled on one of the peculiarities of WinAppDriver. Calculator is a Universal Windows Platform (UWP) app and in order to open a UWP app with WinAppDriver, you need to use the Windows AppID for Calculator. There is a knowledge base article that describes this process, linked below.

I did a similar test to yours just now using the AppID for Calculator to open the app.

Let me know if you are able to open Calculator and complete your test using the Windows AppID.

Regards,
Art

2 Likes

Hello Art,

thank you for your response! It did the job; the script is running fine now on my Windows 10.

We also have Cycle installed on a Windows Server 2016 server. Here Powershell gives this id for the application: {1AC14E77-02E7-4E5D-B744-2EB1AE5198B7}\win32calc.exe. This still gives the ‘Unable to create a new remote session’ message. Should I open the app in another way on this server?

Kind regards,
Henk.

Henk,

It appears Microsoft is not utilizing the UWP version of Calculator in Windows Server 2016, but instead it is using the old classic Windows (Win32) version of the app.

You can open calculator by simply pointing to the executable in Windows Server 2016.

I provisioned a Win Server 2016 VM, and I tested opening the app by specifying the .exe only (since the directory is already in the system PATH), specifying the full path to the .exe, and also by referencing the .exe as an “id”. All three methods worked. It seems WinAppDriver offers a bit more flexibility for opening non-UWP programs.

Images from my test are attached. Please note, I changed the locators to work with the Win32 version of Calculator. The automationID locators I used in the UWP Windows 10 version did not work for me in the Win32 version.



Regards,
Art

Hello Art,

thank you for your research. It solved the problem.

Windows Server has two versions of the calculator app: calc.exe and win32calc.exe.
Using the win32calc.exe solved the problem.

Kind regards,
Henk.