Wait for Windows app to load

Hello
My problem is, that the windows application is starting for like 6-10 sec. The test fails 1/2 times at the beginning of execution. The implicitlyWait doesnt wait for the app. Is there a possibility to wait longer for the application to load?

Current code:

Runtime.getRuntime().exec("cmd.exe /c start " + “WinAppDriver/WinAppDriver.exe”)
Windows.startApplication(GlobalVariable.path)
Windows.getDriver().manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
Windows.setText(findWindowsObject(‘Object Repository/mainWindow/loginWindow/tbUser’), (GlobalVariable.user))
Windows.setText(findWindowsObject(‘Object Repository/mainWindow/loginWindow/tbPassword’), (GlobalVariable.password))

Log:

Caused by: org.openqa.selenium.WebDriverException: Failed to locate opened application window with appId: C:\MyFolder\myApp.exe, and processId: 19468 (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 9.64 seconds
Build info: version: ‘3.141.59’, revision: ‘e82be7d358’, time: ‘2018-11-14T08:25:53’
System info: host: ‘APS00076262-MB’, ip: ‘172.30.240.1’, os.name: ‘Windows 10’, os.arch: ‘amd64’, os.version: ‘10.0’, java.version: ‘1.8.0_181’
Driver info: driver.version: WindowsDriver
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:214)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:166)
at org.openqa.selenium.remote.JsonWireProtocolResponse.lambda$errorHandler$0(JsonWireProtocolResponse.java:54)
at org.openqa.selenium.remote.HandshakeResponse.lambda$getResponseFunction$0(HandshakeResponse.java:30)
at org.openqa.selenium.remote.ProtocolHandshake.lambda$createSession$0(ProtocolHandshake.java:126)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:128)
… 42 more
)
2020-03-19 07:52:27.100 ERROR k.k.c.m.CustomKeywordDelegatingMetaClass - :x: Unable to create a new remote session. Please check the server log for more details. Original error: Failed to locate opened application window with appId: C:\MyFolder\myApp.exe, and processId: 19468 (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 9.64 seconds

1 Like

Hi @piotr.kochanek.2,

On Oct 10, 2019, Microsoft team had published a pre-release version (WinAppDriver v1.2) which includes a new capability ms:waitForAppLaunch. With this capability, you will able to wait longer for your app to open.

In addition, you will also need to install Appium version 1.16.0 or later for supporting WinAppDriver 1.2.

To use ms:waitForAppLaunch capability in Katalon, you could go to Project Settings and add it to the Desired Capabilities section.

Note: “The limit for this is 50 seconds”. So, don’t set it so long /=).

~ Hope this could help! /=)

1 Like

Yep, it’s working for me. Thanks a lot!

1 Like

Hello, excuse me, how did you setup appium to support WinAppDriver?, I have appium installed and initiated in different server name to not have issues with WinAppDriver server listener but somehow when I run the katalon recorder the time set with “ms:waitForAppLaunch” property is not taken and still got time out lower than the property set “25”