When running switch To Window Title, it takes more than 30 seconds to finish execute. How do I find an application window faster
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
WIndows.switchToWindowTitle()
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
switchToWindow(findWindowsObject())
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
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
I have the same problem. Slow switching
Same here. It takes 10-15 seconds ti click on the title bar.
Hi,
Try below steps:
- Windows.getDriver().getwindowhandles() --> this step gives all windowhandle names
- Windows.getDriver().switchto(handlename) --> iterate through each handle
- 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
I’m also facing the same problem. It is very slow and execution time is too long. Somebody please throw some light here.
Thanks
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')
//targetWindow0.setLocatorStrategy(LocatorStrategy.NAME)
//Windows.switchToWindow(targetWindow0)
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')
targetWindow1.setLocatorStrategy(LocatorStrategy.NAME)
// ...or you can use an existing Windows Test Object
WindowsTestObject targetWindow2 = findWindowsObject('Object Repository/Notepad 01/Window', [('title') : 'hello.txt - Notepad'])
Windows.switchToDesktop()
Windows.switchToWindow(targetWindow1)
Windows.setText(findWindowsObject('Object Repository/Notepad 01/Edit'), 'hello')
Windows.closeApplication()
and this is my “existing Windows Test Object” that I used in the example above
Hi, I have tried many things to be able to switch to a window with a certain title and nothing works except one thing.
I have tried all solutions proposed on this page (and others), and the only one that kind of works is
Windows.switchToWindowTitle()
But this process ALWAYS goes trough the full 120 seconds to find it.
Before it switches, I am unable to tell it to switch using a title or a handle
I am unable to get any handle and it won’t find the title
After it switches (using whatever title in the method), I am able to get its title and handle…
I have not found a way to override the 120 seconds or any way to make this work otherwise
It is an HTA app that closes itself to open another HTA one.
I know this is old, but you can override the wait time using:
//Change the wait time
import com.kms.katalon.core.windows.keyword.helper.WindowsActionSettings
WindowsActionSettings.DF_WAIT_ACTION_TIMEOUT_IN_MILLIS = 30000 //30 seconds
When I changed this I get an error finding the window, whereas when I just let the 120 default delay pass it works for me.
Hi there,
Thank you very much for your topic. Please note that it may take a little while before a member of our community or from Katalon team responds to you.
Thanks!