How to open browser tabs in Chrome


#1
//Add the following to the import section of your test case or use "CTRL+SHIFT+O"
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI

//Originally posted by Rajitha_Kithuldeniya
//https://forum.katalon.com/t/webui-how-can-i-open-a-new-tab-on-chrome/5969/10

//Add to the body of any test case
WebUI.openBrowser('https://www.katalon.com/')
WebUI.executeJavaScript('window.open();', [])
currentWindow = WebUI.getWindowIndex()
//Switches tab #1
WebUI.switchToWindowIndex(currentWindow + 1)
WebUI.navigateToUrl('https://www.google.lk')
//Switches tab #0
WebUI.switchToWindowIndex(currentWindow)