Cannot find window with index: '1'

Hi, I am using Chrome browser to execute my test case. The scenario is after clicking a button, a new tab will open. So I need to switch tab by using WebUI.switchToWindowIndex(1). This doesn’t work for me. I have updated the WebDriver for Chrome already but still no luck.

Here’s the error message I received:

=============== ROOT CAUSE =====================
Caused by: com.kms.katalon.core.exception.StepFailedException: Cannot find window with index: ‘1’

For trouble shooting, please visit:

11-23-2020 05:25:01 PM Test Cases/Forms/Building Forms

Elapsed time: 54.670s

Test Cases/Forms/Building Forms FAILED.
com.kms.katalon.core.exception.StepFailedException: Unable to switch to window with index: ‘1’
at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.stepFailed(WebUIKeywordMain.groovy:64)
at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.runKeyword(WebUIKeywordMain.groovy:26)
at com.kms.katalon.core.webui.keyword.builtin.SwitchToWindowIndexKeyword.switchToWindowIndex(SwitchToWindowIndexKeyword.groovy:85)
at com.kms.katalon.core.webui.keyword.builtin.SwitchToWindowIndexKeyword.execute(SwitchToWindowIndexKeyword.groovy:67)
at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:73)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.switchToWindowIndex(WebUiBuiltInKeywords.groovy:1888)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords$switchToWindowIndex$ Source)
at Building Forms:97)
at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(
at com.kms.katalon.core.main.TestCaseExecutor.runScript(
at com.kms.katalon.core.main.TestCaseExecutor.doExecute(
at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(
at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(
at com.kms.katalon.core.main.TestCaseExecutor.execute(
at com.kms.katalon.core.main.TestSuiteExecutor.accessTestCaseMainPhase(
at com.kms.katalon.core.main.TestSuiteExecutor.accessTestSuiteMainPhase(
at com.kms.katalon.core.main.TestSuiteExecutor.execute(
at com.kms.katalon.core.main.TestCaseMain.startTestSuite(
at com.kms.katalon.core.main.TestCaseMain$startTestSuite$ Source)
Caused by: com.kms.katalon.core.exception.StepFailedException: Cannot find window with index: ‘1’
at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.stepFailed(WebUIKeywordMain.groovy:64)
at com.kms.katalon.core.webui.keyword.builtin.SwitchToWindowIndexKeyword$_switchToWindowIndex_closure1.doCall(SwitchToWindowIndexKeyword.groovy:83)
at com.kms.katalon.core.webui.keyword.builtin.SwitchToWindowIndexKeyword$
at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.runKeyword(WebUIKeywordMain.groovy:20)
… 19 more

Thank you in advance!

I found a similar discussion:

The following fragment would be interesting:

int currentTab = WebUI.getWindowIndex()
WebUI.switchToWindowIndex(currentTab + 1)

Hi @kazurayam,
I have tried this method as well didn’t work for me. I am not sure now what to do.

I do not know anything about your Application Under Test, so that I have no more idea.

If you want others to help, you should provide more information so that other people can reproduce your problem on their side. See the following guidance:

At least I would require you to make the URL of your Application Under Test public so that I can see the page on my PC. If your AUT is private, then it would be very difficult for me to dig into your problem.

You may want to update the driver version:

I got the same issue when I want to download a file from google driver when I click on download button, I was redirected to the download page but katalon I think is working on first tabe.


and then :


I got this issue too and with this method, I switched.

HI @costea.georgian89
Thanks for the input. I have tried this but it didn’t work for me. Anyway, I have made a workaround on my script, I just used navigate to URL keyword instead of switching. Thanks for the help!

1 Like

Hi @russel.sevilla
Currently, I am getting same error as you got .Cannot find Window with index 1. Other than navigating to URL ,have you got/came across any other solution?