Desktop app launched but startApplication() steps failed before the wait time

when i am trying to launch desktop app using Windows.startApplication() with desiredCapabilities = {“ms:waitForAppLaunch”:“50”} once i run app is launched after 30 sec but startApplication() failed before that.

I have windriver opened and appium already running.

Here is a console log:
2024-03-22 00:42:00.989 ERROR c.k.k.core.keyword.internal.KeywordMain - :cross_mark: 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:\Users\F.exe, and processId: 13792 (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 8.36 seconds
Build info: version: ‘3.141.59’, revision: ‘e82be7d358’, time: ‘2018-11-14T08:25:53’
System info: host: ‘SEAE-ENG-SC’, ip: ‘172.25.1.101’, os.name: ‘Windows 10’, os.arch: ‘amd64’, os.version: ‘10.0’, java.version: ‘17.0.7’
Driver info: driver.version: WindowsDriver
Build info: version: ‘3.141.59’, revision: ‘e82be7d358’, time: ‘2018-11-14T08:25:53’
System info: host: ‘SEAE-ENG-SC’, ip: ‘172.25.1.101’, os.name: ‘Windows 10’, os.arch: ‘amd64’, os.version: ‘10.0’, java.version: ‘17.0.7’
Driver info: driver.version: WindowsDriver (Root cause: org.openqa.selenium.SessionNotCreatedException: 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:\Users\F.exe, and processId: 13792 (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 8.36 seconds
Build info: version: ‘3.141.59’, revision: ‘e82be7d358’, time: ‘2018-11-14T08:25:53’
System info: host: ‘SEAE-ENG-SC’, ip: ‘172.25.1.101’, os.name: ‘Windows 10’, os.arch: ‘amd64’, os.version: ‘10.0’, java.version: ‘17.0.7’
Driver info: driver.version: WindowsDriver
Build info: version: ‘3.141.59’, revision: ‘e82be7d358’, time: ‘2018-11-14T08:25:53’
System info: host: ‘SEAE-ENG-SC’, ip: ‘172.25.1.101’, os.name: ‘Windows 10’, os.arch: ‘amd64’, os.version: ‘10.0’, java.version: ‘17.0.7’
Driver info: driver.version: WindowsDriver
at io.appium.java_client.remote.AppiumCommandExecutor$1.createSession(AppiumCommandExecutor.java:208)
at io.appium.java_client.remote.AppiumCommandExecutor.createSession(AppiumCommandExecutor.java:217)
at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:239)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552)
at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:42)
at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)
at io.appium.java_client.windows.WindowsDriver.execute(WindowsDriver.java:1)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:213)
at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:131)
at io.appium.java_client.DefaultGenericMobileDriver.(DefaultGenericMobileDriver.java:38)
at io.appium.java_client.AppiumDriver.(AppiumDriver.java:84)
at io.appium.java_client.windows.WindowsDriver.(WindowsDriver.java:38)
at com.kms.katalon.core.windows.driver.WindowsDriverFactory.newWindowsDriver(WindowsDriverFactory.java:194)
at com.kms.katalon.core.windows.driver.WindowsDriverFactory.startApplication(WindowsDriverFactory.java:112)
at com.kms.katalon.core.windows.driver.WindowsDriverFactory.startApplication(WindowsDriverFactory.java:96)
at com.kms.katalon.core.windows.driver.WindowsDriverFactory$startApplication.call(Unknown Source)
at com.kms.katalon.core.windows.keyword.builtin.StartApplicationKeyword$_startApplication_closure1.doCall(StartApplicationKeyword.groovy:32)
at com.kms.katalon.core.windows.keyword.builtin.StartApplicationKeyword$_startApplication_closure1.doCall(StartApplicationKeyword.groovy)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at com.kms.katalon.core.keyword.internal.KeywordMain.runKeyword(KeywordMain.groovy:90)
at com.kms.katalon.core.keyword.internal.KeywordMain$runKeyword.call(Unknown Source)
at com.kms.katalon.core.windows.keyword.builtin.StartApplicationKeyword.startApplication(StartApplicationKeyword.groovy:31)
at com.kms.katalon.core.windows.keyword.builtin.StartApplicationKeyword.execute(StartApplicationKeyword.groovy:27)
at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:74)
at com.kms.katalon.core.windows.keyword.WindowsBuiltinKeywords.startApplication(WindowsBuiltinKeywords.java:34)
at Login.run(Login:21)
at com.kms.katalon.core.main.ScriptEngine.run(ScriptEngine.java:194)
at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(ScriptEngine.java:119)
at com.kms.katalon.core.main.TestCaseExecutor.runScript(TestCaseExecutor.java:448)
at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:439)
at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:418)
at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:410)
at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:285)
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:137)
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:128)
at TempTestCase1711093287914.run(TempTestCase1711093287914.groovy:25)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
Caused by: java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at io.appium.java_client.remote.AppiumCommandExecutor$1.createSession(AppiumCommandExecutor.java:186)
at io.appium.java_client.remote.AppiumCommandExecutor.createSession(AppiumCommandExecutor.java:217)

So please help me out to resolved this issue.

Hi,

Thank you for letting us know your issue. I will ask my team and back to you soon

Hi,

Can you please help check:

As well, it will be much better if you can show us the recording. Thank you!

  1. I have winapp driver installed which is version 1.2 onwards.
  2. I have tried with Start application with title

but getting same error.

I have kept “ms:waitForAppLaunch”: “50”, once i clicked on run windows first step which is Start application with title is failed in 13.1638 sec.

why it is failing before wait time which is “ms:waitForAppLaunch”: “50”..

Please reply asap.

Hi.

Can you please help record a similar video on your computer like this: https://somup.com/cZfVh4CtLn so that we can better support you? Or you can record your all project, just to follow the steps on video? Thank you

hi @schakarwar

two things from your post. the step fails in 13 seconds while you set ms:waitForAppLaunch to 50, so the capability is not being applied. in katalon’s desired capabilities the value type matters, that one has to be Number, not String, winappdriver ignores “50” in quotes. check the type column in Project > Settings > Desired Capabilities > Windows.

even with that fixed, the error text “failed to locate opened application window with appId C:\Users\F.exe” means winappdriver never saw a top level window owned by the process it launched. apps that start through a launcher or splash process (the first exe exits and spawns the real one) always do this, no matter how long you wait. the fix for those is to launch the exe yourself and attach to the window by title:

Runtime.getRuntime().exec('C:\\Users\\F.exe')
WebUI.delay(30)
Windows.startApplicationWithTitle('your main window title')

grab the exact title from the window after it is fully up. once you attach that way the waitForAppLaunch cap does not matter at all.