I’m using Chrome
How can I fix this ?
Its similar to a breakpoint.

hi Clau,
while browsing website our default focus is on website, but when any dialog box pop ups we have to shift out focus to new window.
use WebUI.switchToWindowIndex(1)
for 1st pop use index as 1, for 2nd use index as 2 and so on… you can handle many pop up using this.
thanks and regards,
sanket gharat.
I am stuck at the same point the click event stays stuck. I tried what was suggested, it did not fix my problem.
@paudet Another option to use is to use the title of the pop-up, if it has one. If it does have a title, then copy the title right from the pop-up and paste it in the method parameter. An example is below:
WebUI.switchToWindowTitle(‘Decision Tree > HistoryList’)
After dealing with the pop-up, then move back to the main page by using:
WebUI.switchToDefaultContent()
This assumes it is a pop-up and not an Alert. If it is an Alert, then there are other methods for them.
Hello. thanks for answering me. The thing is that this popup has no title; it is the print popup of Chrome when a print button is clicked on the page.
@paudet How about trying some of the Alert methods, like:
verifyAlertPresent (int timeOut)
acceptAlert ()
dismissAlert ()
waitForAlert (int timeOut)
Yes I have tried those too already, it won’t work. I have also tried the robot() and sending the VK_ESCAPE key or VK_ENTER key too, nothing works.
The thing is it never gets passed the “click”. it stays stuck, it does not go to the next check. Have you tried it ?
I tried this and it working for my certain print button
WebUI.click(findTestObject(‘Page Title/button_Print’), FailureHandling.STOP_ON_FAILURE)
‘Close print window’
WebUI.closeWindowIndex(1)
‘Optional’
WebUI.delay(2)
‘switch to main tab’
WebUI.switchToWindowIndex(0)
Mine hangs on the click(). It waits for something it doesn’t even go to my next command which is one of those suggestions here like WebUI.closeWindowsIndex or other. But if I manually click the cancel on the print dialog, then the test case resumes and tries to do WebUI.closeWindowIndex(1) and the following commands.
Hi @paudet
I am having the same issue now. were you able to resolve it? I just wanted to escape out of the print preview and switch back to the previous window. Please share if you were able to resolve. Thanks!
Hi Hamsika,
Could you note steps to reproduce or video record on the issues?
If a new tab is opened for the print view, try to move two windows index.
If your current index is 0, once the tab for print view is opened, move immediately to index 2
int currentTab = WebUI.getWindowIndex()
Event that open print view
WebUI.switchToWindowIndex(currentTab + 2)
If you want to close it, try with
WebUI.closeWindowIndex(currentTab + 1)
I get the same issue where it gets stuck in click step. The Chrome print window comes up, then the next step to WebUI.switchToWindowIndex() doesn’t get executed since it’s still stuck on the click step
I have not been able to resolve to this day. I just tried it again, same problem.
Hi ,
I came across the same issue and on page refresh, chrome print dialog is went away. so I used the following code and its worked fine for me. try from your side.
WebUI.refresh()
WebUI.waitForPageLoad(10,FailureHandling.OPTIONAL)
Thanks
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!
My test case is failing on clicking on print button. I tried both switch window method and robot but nothing is working… Do you have a resolution for this issue ??
What is your error log saying about your situation after you hit the Print button? Did you try @patricio.rodriguez suggestion to move up two “indexes”?
Can you share the full error logs
yes, I tried moving indexes but the problem is after clicking the “Print” findObject, it is getting stuck at same point and not moving to next step. Even though If I write the methods(robot or switch indexes or anything) after clicking the print button there is no use.
Feb 03, 2025 10:20:33 AM com.kms.katalon.core.logging.KeywordLogger logWarning
WARNING: Cannot take screenshot
Feb 03, 2025 10:20:33 AM com.kms.katalon.core.logging.KeywordLogger logFailed
SEVERE:
Unable to click on object ‘Object Repository/Print/Page_ExpertPay - The Child Support Payment Center/button_Print’ (Root cause: com.kms.katalon.core.exception.StepFailedException: Unable to click on object ‘Object Repository/Print/Page_ExpertPay - The Child Support Payment Center/button_Print’
at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.stepFailed(WebUIKeywordMain.groovy:117)
at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.runKeyword(WebUIKeywordMain.groovy:43)
at com.kms.katalon.core.webui.keyword.builtin.ClickKeyword.click(ClickKeyword.groovy:75)
at com.kms.katalon.core.webui.keyword.builtin.ClickKeyword.execute(ClickKeyword.groovy:40)
at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:74)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.click(WebUiBuiltInKeywords.groovy:696)
at 157037-Print Option in RegisterObligor Successful Flow.run(157037-Print Option in RegisterObligor Successful Flow:106)
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:133)
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:124)
at TempTestCase1738595637041.run(TempTestCase1738595637041.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.TimeoutException: java.net.http.HttpTimeoutException: request timed out
Build info: version: ‘4.22.0’, revision: ‘c5f3146703’
System info: os.name: ‘Windows 11’, os.arch: ‘amd64’, os.version: ‘10.0’, java.version: ‘17.0.7’
Driver info: com.kms.katalon.selenium.driver.CChromeDriver
Command: [c8a9fb95024f6227b3c5c8be388437f9, clickElement {id=f.60A7CD0EFAE7909C952269CA71FE9F9D.d.F02EF6640235772FF2B4B0CB9C35D282.e.459}]
Capabilities {acceptInsecureCerts: false, browserName: chrome, browserVersion: 132.0.6834.159, chrome: {chromedriverVersion: 131.0.6778.85 (3d81e41b6f3a…, userDataDir: C:\Users\52371421\AppData\L…}, fedcm:accounts: true, goog:chromeOptions: {debuggerAddress: localhost:58351}, networkConnectionEnabled: false, pageLoadStrategy: normal, platformName: windows, proxy: Proxy(), se:cdp: ws://localhost:58351/devtoo…, se:cdpVersion: 132.0.6834.159, setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: ignore, webSocketUrl: ws://localhost:7738/session…, webauthn:extension:credBlob: true, webauthn:extension:largeBlob: true, webauthn:extension:minPinLength: true, webauthn:extension:prf: true, webauthn:virtualAuthenticators: true}
Element: [[CChromeDriver: chrome on windows (c8a9fb95024f6227b3c5c8be388437f9)] → xpath: (//button[@type=‘button’])[2]]
Session ID: c8a9fb95024f6227b3c5c8be388437f9
at org.openqa.selenium.remote.http.jdk.JdkHttpClient.execute0(JdkHttpClient.java:389)
at org.openqa.selenium.remote.http.AddSeleniumUserAgent.lambda$apply$0(AddSeleniumUserAgent.java:42)
at org.openqa.selenium.remote.http.Filter.lambda$andFinally$1(Filter.java:55)
at org.openqa.selenium.remote.http.jdk.JdkHttpClient.execute(JdkHttpClient.java:355)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:187)
at org.openqa.selenium.remote.service.DriverCommandExecutor.invokeExecute(DriverCommandExecutor.java:216)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:174)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:518)
at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:223)
at org.openqa.selenium.remote.RemoteWebElement.click(RemoteWebElement.java:76)
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 org.openqa.selenium.support.decorators.WebDriverDecorator.call(WebDriverDecorator.java:249)
at org.openqa.selenium.support.decorators.DefaultDecorated.call(DefaultDecorated.java:48)
at org.openqa.selenium.support.decorators.WebDriverDecorator.lambda$createProxy$2(WebDriverDecorator.java:321)
at net.bytebuddy.renamed.java.lang.Object$ByteBuddy$COSzX8aJ.click(Unknown Source)
at org.openqa.selenium.WebElement$click.call(Unknown Source)
at org.openqa.selenium.WebElement$click.call(Unknown Source)
at com.kms.katalon.core.webui.keyword.builtin.ClickKeyword.clickUntilSuccessWithTimeout(ClickKeyword.groovy:82)
at com.kms.katalon.core.webui.keyword.builtin.ClickKeyword.clickUntilSuccessWithTimeout(ClickKeyword.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.webui.keyword.builtin.ClickKeyword$_click_closure1.doCall(ClickKeyword.groovy:68)
at com.kms.katalon.core.webui.keyword.builtin.ClickKeyword$_click_closure1.call(ClickKeyword.groovy)
at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.runKeyword(WebUIKeywordMain.groovy:35)
at com.kms.katalon.core.webui.keyword.builtin.ClickKeyword.click(ClickKeyword.groovy:75)
at com.kms.katalon.core.webui.keyword.builtin.ClickKeyword.execute(ClickKeyword.groovy:40)
at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:74)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.click(WebUiBuiltInKeywords.groovy:696)
at Script1738006461508.run(Script1738006461508.groovy:106)
… 13 more
Caused by: java.net.http.HttpTimeoutException: request timed out
at java.net.http/jdk.internal.net.http.ResponseTimerEvent.handle(ResponseTimerEvent.java:63)
at java.net.http/jdk.internal.net.http.HttpClientImpl.purgeTimeoutsAndReturnNextDeadline(HttpClientImpl.java:1270)
at java.net.http/jdk.internal.net.http.HttpClientImpl$SelectorManager.run(HttpClientImpl.java:899)
)