Caused by: org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Response code 400. Message: Bad capabilities. Specify either app or appTopLevelWindow to create a session

I am using katalon version 10.4.3-167ecabe7b

I downloaded WinAppDriver although I heard it isnt necessary. While running desktop, I keep getting this error.

Test Cases/testcase 2 FAILED.

Reason:

com.kms.katalon.core.exception.StepFailedException: Could not start a new session. Response code 400. Message: Bad capabilities. Specify either app or appTopLevelWindow to create a session

Host info: host: ‘DESKTOP-ICKIV8F’, ip: ‘172.21.2.73’

Build info: version: ‘4.34.0’, revision: ‘707dcb4246*’

System info: os.name: ‘Windows 11’, os.arch: ‘amd64’, os.version: ‘10.0’, java.version: ‘17.0.14’

Driver info: io.appium.java_client.windows.WindowsDriver

Command: [null, newSession {capabilities=[Capabilities {appium:app: C:\Windows\System32\notepad…, appium:appWorkingDir: C:\Windows\System32, appium:automationName: FlaUI, platformName: windows}]}]

Capabilities {appium:app: C:\Windows\System32\notepad…, appium:appWorkingDir: C:\Windows\System32, appium:automationName: FlaUI, platformName: windows} (Root cause: org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Response code 400. Message: Bad capabilities. Specify either app or appTopLevelWindow to create a session

Host info: host: ‘DESKTOP-ICKIV8F’, ip: ‘172.21.2.73’

Build info: version: ‘4.34.0’, revision: ‘707dcb4246*’

System info: os.name: ‘Windows 11’, os.arch: ‘amd64’, os.version: ‘10.0’, java.version: ‘17.0.14’

Driver info: io.appium.java_client.windows.WindowsDriver

Command: [null, newSession {capabilities=[Capabilities {appium:app: C:\Windows\System32\notepad…, appium:appWorkingDir: C:\Windows\System32, appium:automationName: FlaUI, platformName: windows}]}]

Capabilities {appium:app: C:\Windows\System32\notepad…, appium:appWorkingDir: C:\Windows\System32, appium:automationName: FlaUI, platformName: windows}

at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:114)

at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:75)

at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:61)

at io.appium.java_client.remote.AppiumCommandExecutor.createSession(AppiumCommandExecutor.java:179)

at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:244)

at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:544)

at io.appium.java_client.AppiumDriver.startSession(AppiumDriver.java:313)

at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:173)

at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:101)

at io.appium.java_client.windows.WindowsDriver.<init>(WindowsDriver.java:46)

at com.kms.katalon.core.windows.driver.WindowsDriverFactory.newWindowsDriver(WindowsDriverFactory.java:187)

at com.kms.katalon.core.windows.driver.WindowsDriverFactory.startApplication(WindowsDriverFactory.java:140)

at com.kms.katalon.core.windows.driver.WindowsDriverFactory.startApplication(WindowsDriverFactory.java:100)

at com.kms.katalon.core.windows.driver.WindowsDriverFactory$startApplication.call(Unknown Source)

at com.kms.katalon.core.windows.keyword.builtin.StartApplicationWithTitleKeyword$\_startApplicationWithTitle_closure1.doCall(StartApplicationWithTitleKeyword.groovy:35)

at com.kms.katalon.core.windows.keyword.builtin.StartApplicationWithTitleKeyword$\_startApplicationWithTitle_closure1.doCall(StartApplicationWithTitleKeyword.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.StartApplicationWithTitleKeyword.startApplicationWithTitle(StartApplicationWithTitleKeyword.groovy:34)

at com.kms.katalon.core.windows.keyword.builtin.StartApplicationWithTitleKeyword.execute(StartApplicationWithTitleKeyword.groovy:29)

at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:90)

at com.kms.katalon.core.windows.keyword.WindowsBuiltinKeywords.startApplicationWithTitle(WindowsBuiltinKeywords.java:1310)

at testcase 2.run(testcase 2:20)

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:490)

at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:481)

at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:460)

at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:452)

at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:322)

at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:151)

at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:139)

at TempTestCase1771906238920.run(TempTestCase1771906238920.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)

)

at com.kms.katalon.core.keyword.internal.KeywordMain.stepFailed(KeywordMain.groovy:51)

at com.kms.katalon.core.keyword.internal.KeywordMain.stepFailed(KeywordMain.groovy)

at com.kms.katalon.core.keyword.internal.KeywordMain.runKeyword(KeywordMain.groovy:92)

at com.kms.katalon.core.keyword.internal.KeywordMain$runKeyword.call(Unknown Source)

at com.kms.katalon.core.windows.keyword.builtin.StartApplicationWithTitleKeyword.startApplicationWithTitle(StartApplicationWithTitleKeyword.groovy:34)

at com.kms.katalon.core.windows.keyword.builtin.StartApplicationWithTitleKeyword.execute(StartApplicationWithTitleKeyword.groovy:29)

at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:90)

at com.kms.katalon.core.windows.keyword.WindowsBuiltinKeywords.startApplicationWithTitle(WindowsBuiltinKeywords.java:1310)

at testcase 2.run(testcase 2:20)

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:490)

at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:481)

at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:460)

at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:452)

at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:322)

at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:151)

at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:139)

at TempTestCase1771906238920.run(TempTestCase1771906238920.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: org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Response code 400. Message: Bad capabilities. Specify either app or appTopLevelWindow to create a session

Host info: host: ‘DESKTOP-ICKIV8F’, ip: ‘172.21.2.73’

Build info: version: ‘4.34.0’, revision: ‘707dcb4246*’

System info: os.name: ‘Windows 11’, os.arch: ‘amd64’, os.version: ‘10.0’, java.version: ‘17.0.14’

Driver info: io.appium.java_client.windows.WindowsDriver

Command: [null, newSession {capabilities=[Capabilities {appium:app: C:\Windows\System32\notepad…, appium:appWorkingDir: C:\Windows\System32, appium:automationName: FlaUI, platformName: windows}]}]

Capabilities {appium:app: C:\Windows\System32\notepad…, appium:appWorkingDir: C:\Windows\System32, appium:automationName: FlaUI, platformName: windows}

at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:114)

at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:75)

at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:61)

at io.appium.java_client.remote.AppiumCommandExecutor.createSession(AppiumCommandExecutor.java:179)

at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:244)

at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:544)

at io.appium.java_client.AppiumDriver.startSession(AppiumDriver.java:313)

at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:173)

at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:101)

at io.appium.java_client.windows.WindowsDriver.<init>(WindowsDriver.java:46)

at com.kms.katalon.core.windows.driver.WindowsDriverFactory.newWindowsDriver(WindowsDriverFactory.java:187)

at com.kms.katalon.core.windows.driver.WindowsDriverFactory.startApplication(WindowsDriverFactory.java:140)

at com.kms.katalon.core.windows.driver.WindowsDriverFactory.startApplication(WindowsDriverFactory.java:100)

at com.kms.katalon.core.windows.driver.WindowsDriverFactory$startApplication.call(Unknown Source)

at com.kms.katalon.core.windows.keyword.builtin.StartApplicationWithTitleKeyword$\_startApplicationWithTitle_closure1.doCall(StartApplicationWithTitleKeyword.groovy:35)

at com.kms.katalon.core.windows.keyword.builtin.StartApplicationWithTitleKeyword$\_startApplicationWithTitle_closure1.doCall(StartApplicationWithTitleKeyword.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)

... 19 more

I’m not sure what to do

2 Likes

Welcome to our community! Feel free to browse previously answered questions. Our community will jump in to assist you :star_struck:

Bella

This error is not about WinAppDriver installation, it’s about how the session is being created in Katalon Studio 10.4.3.

The key error is:

Bad capabilities. Specify either app or appTopLevelWindow to create a session


:white_check_mark: Why This Is Happening

In Katalon 10+, Windows automation uses FlaUI (Windows UIA3) by default — not WinAppDriver.

Your capabilities show:

appium:automationName: FlaUI
platformName: windows

So Katalon is NOT using WinAppDriver.

That’s fine — WinAppDriver is not required anymore.

But your issue is:

You are using:

Windows.startApplicationWithTitle(...)

This keyword is meant to attach to an already opened window (using appTopLevelWindow).

However, your capabilities show:

appium:app: C:\Windows\System32\notepad...

So it’s trying to launch using app, but internally the keyword expects appTopLevelWindow.

:backhand_index_pointing_right: That mismatch causes the 400 Bad Capabilities error.


How To Fix It (Choose ONE Method)


OPTION 1 (Recommended): Use startApplication()

If you want to launch Notepad directly, use:

Windows.startApplication("C:\\Windows\\System32\\notepad.exe")

:cross_mark: Do NOT use startApplicationWithTitle() unless the app is already running.


OPTION 2: If Using startApplicationWithTitle()

Then:

  1. Manually open Notepad first

  2. Then use:

Windows.startApplicationWithTitle("Untitled - Notepad")

This attaches to an existing window using appTopLevelWindow.


Important Check (Very Important)

Go to:

Project Settings → Execution → Windows

Make sure:

  • Automation Name = FlaUI

  • Platform Name = Windows

  • Do NOT manually set app capability there

Let Katalon handle it automatically.


Also Important (Windows 11 Issue)

If you’re on Windows 11:

Run Katalon as Administrator.

FlaUI sometimes fails to attach without admin rights.


Quick Clean Setup (Best Practice)

  1. Close Katalon

  2. Kill any running WinAppDriver.exe

  3. Open Katalon as Administrator

  4. Use:

Windows.startApplication("C:\\Windows\\System32\\notepad.exe")

That should work immediately.


Extra Clarification

You mentioned:

I downloaded WinAppDriver although I heard it isn’t necessary.

Correct :white_check_mark:

In Katalon 10+, WinAppDriver is optional. FlaUI is built-in and more stable.

You only need WinAppDriver if:

  • You explicitly configure Katalon to use WinAppDriver

  • Or you are using legacy Windows automation

Otherwise → ignore it.

1 Like

If it fails again then share some more details like below

  1. Screenshot of project settting→ Windows
  2. Line 20 test code exact

You’re hitting a common Windows-desktop automation error: the Windows driver (WinAppDriver/Appium for Windows) is rejecting the session because the capabilities didn’t include a valid app identifier. The error says: “Bad capabilities. Specify either app or appTopLevelWindow to create a session.”

What this means (short):

  • The driver needs either an “app” capability (an executable path or AppUserModelID) or an “appTopLevelWindow” capability (a window handle in hex) to create a session. The value Katalon sent appears malformed/truncated in your log (C:\Windows\System32\notepad…).

Immediate checklist and recommended fixes (do these in order):

  1. Use a correct “app” value

    • If you want Notepad, supply the full executable path, properly escaped: C:\Windows\System32\notepad.exe

    • Alternatively, for UWP apps use the AppUserModelID (for example: Microsoft.WindowsCalculator_8wekyb3d8bbwe!App) as the app capability.

    • Do not use an ellipsis or truncated path. Ensure the capability string in your test is exact.

  2. Confirm how you call the Katalon keyword

    • If you use Start Application With Title (WindowsBuiltInKeywords.startApplicationWithTitle), make sure the first argument is the full app path or AppUserModelID and the second argument (title) matches the real window title (or pass null if using only app capability depending on your code).
  3. Verify WinAppDriver / Windows automation daemon is running and accessible

    • Start WinAppDriver.exe as Administrator before running the test (if using WinAppDriver). Katalon will use a Windows driver endpoint; that service must be listening.

    • If you intentionally rely on FlaUI (Katalon can be configured to use FlaUI as automation engine), ensure the environment supports it. But regardless of automation engine, the app or appTopLevelWindow capability is required.

  4. If you prefer appTopLevelWindow instead of app

    • You can set appTopLevelWindow to the top-level window handle in hex (e.g. “0x00123456”). This is useful if attaching to an already running app window.

    • To get the handle, you can use tools such as Spy++/Inspect.exe or a small script to list window handles and convert to hex.

  5. Check capability names and escaping

    • Ensure capability keys are correct (app or appTopLevelWindow). JSON/capability formatting errors or wrong key names will be rejected.

    • In Katalon, when you set the app path in code or Test Object, make sure backslashes are doubled (\) or use single forward slashes (/) where allowed.

  6. Run a minimal working example

    • Create a tiny test where you call Start Application (or Start Application With Title) with a single capability: full path to notepad.exe. If that works, add other caps back.
  7. Permission / bitness / platform issues

    • Run WinAppDriver as Admin and ensure your Windows and WinAppDriver bitness match (usually WinAppDriver x64 on 64-bit Windows).
  8. Logs and what to look for

    • If it still fails, capture the exact capabilities Katalon is sending (it’s shown in the stack trace). Verify the app value is not truncated and matches one of the accepted forms.

Quick examples (conceptual):

  • app capability: C:\Windows\System32\notepad.exe

  • app capability (UWP): Microsoft.WindowsCalculator_8wekyb3d8bbwe!App

  • appTopLevelWindow: “0x00123456” (hex string of HWND)