Can't Automate Windows Calculator

Hello,

I’m having trouble automate the windows calculator. When I click on the Window Recorder, give my file path (C:\Windows\System32\calc.exe), and then click start to start the recording, the calculator opens but I got this error message.

Please help if you know how to solve this issue. Thank you.

java.util.concurrent.ExecutionException: 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:\Windows\System32\calc.exe, and processId: 9856 (WARNING: The server did not provide any stacktrace information)

Command duration or timeout: 318 milliseconds

Build info: version: ‘3.141.59’, revision: ‘unknown’, time: ‘unknown’

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

Driver info: driver.version: WindowsDriver

Build info: version: ‘3.141.59’, revision: ‘unknown’, time: ‘unknown’

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

Driver info: driver.version: WindowsDriver

at com.kms.katalon.composer.components.impl.dialogs.ProgressMonitorDialogWithThread.runAndWait(ProgressMonitorDialogWithThread.java:49)

at com.kms.katalon.composer.windows.dialog.WindowsAppComposite$5.run(WindowsAppComposite.java:239)

at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:122)

Caused by: 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:\Windows\System32\calc.exe, and processId: 9856 (WARNING: The server did not provide any stacktrace information)

Command duration or timeout: 318 milliseconds

Build info: version: ‘3.141.59’, revision: ‘unknown’, time: ‘unknown’

System info: host: ‘’, ip: ‘1’, os.name: ‘Windows 11’, os.arch: ‘amd64’, os.version: ‘10.0’, java.version: ‘17.0.7’

Driver info: driver.version: WindowsDriver

Build info: version: ‘3.141.59’, revision: ‘unknown’, time: ‘unknown’

System info: host: ‘’, ip: ‘’, os.name: ‘Windows 11’, 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:184)

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

at com.kms.katalon.composer.windows.spy.WindowsInspectorController.startApplication(WindowsInspectorController.java:149)

at com.kms.katalon.composer.windows.dialog.WindowsAppComposite$5$1.call(WindowsAppComposite.java:242)

at com.kms.katalon.composer.components.impl.dialogs.ProgressMonitorDialogWithThread.startThreadAndWait(ProgressMonitorDialogWithThread.java:36)

at com.kms.katalon.composer.components.impl.dialogs.ProgressMonitorDialogWithThread.runAndWait(ProgressMonitorDialogWithThread.java:48)

… 2 more

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)

… 19 more

Caused by: org.openqa.selenium.WebDriverException: Failed to locate opened application window with appId: C:\Windows\System32\calc.exe, and processId: 9856 (WARNING: The server did not provide any stacktrace information)

Command duration or timeout: 318 milliseconds

Build info: version: ‘3.141.59’, revision: ‘unknown’, time: ‘unknown’

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

Driver info: driver.version: WindowsDriver

at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77)

at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)

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)

… 23 more

1 Like

kindly format your code with ``` for better readability

To automate the Windows Calculator using Katalon Studio, follow these steps to resolve the common issues with WinAppDriver:

Step-by-Step Solution:

  1. Use Correct Calculator Path:

groovy

// Use this path for modern Windows 10/11 Calculator
String calculatorPath = "Microsoft.WindowsCalculator_8wekyb3d8bbwe!App"

// Or try the UWP version path
// String calculatorPath = "C:\\Windows\\System32\\calc.exe"
  1. Start WinAppDriver Before Execution:
  • Download WinAppDriver
  • Run it as Administrator before executing tests
  • Default URL: http://127.0.0.1:4723/
  1. Katalon Script Configuration:

groovy

import org.openqa.selenium.windows.WindowsDriver
import org.openqa.selenium.remote.DesiredCapabilities

// Configure Desired Capabilities
DesiredCapabilities capabilities = new DesiredCapabilities()
capabilities.setCapability("app", calculatorPath)
capabilities.setCapability("platformName", "Windows")
capabilities.setCapability("deviceName", "WindowsPC")

// Initialize WindowsDriver
WindowsDriver driver = new WindowsDriver(new URL("http://127.0.0.1:4723"), capabilities)
  1. Handle UAC Prompt (If Appearing):

groovy

// Add this capability to bypass UI automation restrictions
capabilities.setCapability("ms:waitForAppLaunch", 15)

Troubleshooting Checklist:

  1. Run as Administrator:
  • Run Katalon Studio as Administrator
  • Run WinAppDriver as Administrator
  1. Calculator Version Compatibility:
  • For Windows 10/11, use the UWP Calculator path shown above
  • For older Windows versions, try:

groovy

String calculatorPath = "C:\\Windows\\System32\\calc.exe"
  1. Check Calculator Process:
  • Ensure Calculator isn’t running in background before test

groovy

Runtime.getRuntime().exec("taskkill /f /im Calculator.exe")
  1. WinAppDriver Logs:
  • Check logs at C:\Program Files (x86)\Windows Application Driver\WinAppDriver.log for detailed errors
  1. Firewall Exception:
  • Allow WinAppDriver.exe through Windows Defender Firewall

Alternative Automation Approach:

If WinAppDriver issues persist, use Windows native automation:

groovy

// Example using autoIT integration
Runtime.getRuntime().exec("autoit_script.exe")

// Sample autoIT script (calculator.au3)
WinActivate("Calculator")
ControlClick("Calculator", "", "Button1")  // Clicks '1'
ControlClick("Calculator", "", "Button23") // Clicks '='

Final Verification:

After implementation, check:

  1. WinAppDriver is running (system tray icon visible)
  2. No Calculator instances running before test
  3. Correct capabilities set for your Windows version
  4. Katalon and WinAppDriver both running as Administrator

Did you start the WindowsAppDriver before using the recorder ?