# Web Recorder cannot open new tab

**URL:** <https://forum.katalon.com/t/web-recorder-cannot-open-new-tab/84820>\
**Category:** Web Testing\
**Tags:** katalon-studio\
**Created:** [March 1, 2023, 1:44am UTC](https://forum.katalon.com/t/web-recorder-cannot-open-new-tab/84820 "2023-03-01T01:44:36Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Veritas](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/veritas/32/22419_2.png) [@Veritas](https://forum.katalon.com/u/Veritas)\
**Post date:** [March 1, 2023, 1:44am UTC](https://forum.katalon.com/t/web-recorder-cannot-open-new-tab/84820/1 "2023-03-01T01:44:36Z")

</div>

I am currently testing this website that displays new tab when I am done with the process, I cannot finish the process since Katalon Studio Codeless Web Recorder cannot open new tab. What solution did you guys do when you encountered this problem? Thanks!

---

<div class="post-metadata">

**Author:** ![grylion54](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/grylion54/32/16265_2.png) [@grylion54](https://forum.katalon.com/u/grylion54)\
**Post date:** [March 2, 2023, 4:36pm UTC](https://forum.katalon.com/t/web-recorder-cannot-open-new-tab/84820/3 "2023-03-02T16:36:10Z")

</div>

The code below can be added to make a Keyword that you can use to open a second tab. You can either supply the Keyword with an URL or you can create a second Keyword that does **not** need a parameter but you can use a Global Variable to supply the URL instead. You can also close the second tab by calling the close routine either from within the open routine or by Keyword if you want.

```auto
import java.awt.Robot
import java.awt.Toolkit
import java.awt.datatransfer.StringSelection
import java.awt.event.KeyEvent

	/*
	 * This routine opens a second tab, sets the ....
	 */
	@Keyword
	def openSecondTab(String siteURL) {

		Robot robot = new Robot()
		robot.keyPress(KeyEvent.VK_CONTROL)
		robot.keyPress(KeyEvent.VK_T)
		robot.keyRelease(KeyEvent.VK_CONTROL)
		robot.keyRelease(KeyEvent.VK_T)
		WebUI.waitForPageLoad(10)

		WebUI.switchToWindowIndex(1)

		WebUI.navigateToUrl(siteURL)
		WebUI.waitForPageLoad(10)

		WebUI.waitForElementVisible(findTestObject('...'), 10)

     }

	/*
	 * This routine closes the second tab.
	 */
	@Keyword
	def closeSecondTab() {

		"close this tab"
		Robot robot = new Robot()
		robot.keyPress(KeyEvent.VK_CONTROL)
		robot.keyPress(KeyEvent.VK_W)
		robot.keyRelease(KeyEvent.VK_CONTROL)
		robot.keyRelease(KeyEvent.VK_W)
	}

```

Edit: when using the Robot, **you** cannot be using the mouse or keyboard at the same time as it is running!  
Edit2: If you make two Keywords of **openSecondTab** , you have to remove the parameter (or change the number of parameters) the Keyword has in the second Keyword.

---

<div class="post-metadata">

**Author:** ![daniel.makra](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/daniel.makra/32/18397_2.png) [@daniel.makra](https://forum.katalon.com/u/daniel.makra)\
**Post date:** [March 2, 2023, 5:19pm UTC](https://forum.katalon.com/t/web-recorder-cannot-open-new-tab/84820/4 "2023-03-02T17:19:16Z")

</div>

Robot is a nice touch, but I prefer:

```auto
WebUI.executeJavaScript('window.open();', [])

```

Then you can switch to the new window and continue your work.

---

<div class="post-metadata">

**Author:** ![Noor\_Ahmed\_Khan](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/noor_ahmed_khan/32/16104_2.png) [@Noor\_Ahmed\_Khan](https://forum.katalon.com/u/Noor_Ahmed_Khan)\
**Post date:** [March 13, 2023, 7:05am UTC](https://forum.katalon.com/t/web-recorder-cannot-open-new-tab/84820/5 "2023-03-13T07:05:18Z")

</div>

Did you find out solution ?

---

<div class="post-metadata">

**Author:** ![ntbichngoc](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/ntbichngoc/32/23869_2.png) [@ntbichngoc](https://forum.katalon.com/u/ntbichngoc)\
**Post date:** [December 5, 2023, 2:50am UTC](https://forum.katalon.com/t/web-recorder-cannot-open-new-tab/84820/6 "2023-12-05T02:50:39Z")

</div>

Did you find the solution?
