Switch to window title takes long - desktop app

When running switch To Window Title, it takes more than 30 seconds to finish execute. How do I find an application window faster

1 Like

How is it written in your script? Because I have no problems with changing windows and it goes pretty fast.

I use:
Windows.startApplicationWithTitle() followed by

I just decided to run the script with these two lines and necessary parameters and it took 10s to switch

However if I use
Windows.startApplicationWithTitle() followed by

then it takes 1s

Also i am using Windows.startApplicationWithTitle() multiple times to start multiple applications

Ah, this is for a desktop app right?
I thought this was a webbased question. I got no experience in desktop apps with Katalon. Only using the WebUI one. Sorry can’t help you with this :frowning:

Hope someone else can!

Hello Safrad,
Greetings !!

I just started with my desktop automation and facing the same issue- switching between windows is too slow. appreciate if you can assist me in resolving this issue

1 Like

I have the same problem. Slow switching :confused:

Same here. It takes 10-15 seconds ti click on the title bar.


Try below steps:

  1. Windows.getDriver().getwindowhandles() --> this step gives all windowhandle names
  2. Windows.getDriver().switchto(handlename) --> iterate through each handle
  3. Windows.getDriver().gettitle().equals() --> compare the title, if match, use the handle else, get back current to window handle

Note: this works if you want to switch between same application windows, because getwindowhandles() method returns windows of application we are using

1 Like

I’m also facing the same problem. It is very slow and execution time is too long. Somebody please throw some light here.


Hi @ram.natarajan ,

I saw that @safrazd has found a workaround for this issue, but it seems not really clear for anyone to follow.

So, I will show here a demo script for that solution.

import com.kms.katalon.core.testobject.WindowsTestObject
import com.kms.katalon.core.testobject.WindowsTestObject.LocatorStrategy

Windows.startApplicationWithTitle('notepad', '')

// Or if you want to switch to another window immediately, use this:

//Windows.startApplicationWithTitle('Root', '')
//WindowsTestObject targetWindow0 = new WindowsTestObject()
//targetWindow0.setLocator('hello.txt - Notepad')

Windows.setText(findWindowsObject('Object Repository/Notepad 01/Edit'), 'hello')

// You can create a dummy Windows Test Object
WindowsTestObject targetWindow1 = new WindowsTestObject()
targetWindow1.setLocator('hello.txt - Notepad')

// ...or you can use an existing Windows Test Object
WindowsTestObject targetWindow2 = findWindowsObject('Object Repository/Notepad 01/Window', [('title') : 'hello.txt - Notepad'])




and this is my “existing Windows Test Object” that I used in the example above

1 Like