Handling Web element locators using Katalon Studio

This is a companion discussion topic for the original entry at https://docs.katalon.com/katalon-studio/docs/web_element_locators.html

Can I use selenium defined locator format into katalon ? If yes then how can i use it?
private static final By SERVICES_MENU = By.xpath("//span[contains(text(),‘Services’)]");

I have recorded few test cases over the past few months but now the UI has changed and my tests are failing.
Changes -

  1. Login page has been redesigned (although all the texts, labels, buttons remains the same)
  2. All the menu/submenu items that were placed horizontally on top of the page, are not placed vertically in a panel on the left side of the page.
    3.The position of the text fields have been changed slightly

I read through your blog ‘Handling Web element locators using Katalon Studio’ and realized that I have been using unique element properties/attributes for most of my objects, which means that my tests should still be able to find these objects no matter where it is located- is it right to say so ?
Please let me know if there is there is any way I can re-use my tests, else I will have to re-record all of them on the new UI.
Many thanks in advance for your support.


When I click on a link from a web page, it opens another web page in a 2nd tab. Any elements within that second tab cannot be accessed. I have tried everything from using recorded scripts within my script to replacing xpaths from the inspect feature in the browser for that element. Nothing i have tried fixes the issue. Please advise on how we can go about this problem since this is definitely a show stopped for us in using Katalon as web automation tool. Thanks.

You can switch to the new tab by WebUI.switchWindow*.

That is not the problem. I am already in the current tab I want to be in. What I am saying is that any elements within the web page of the active tab, cannot be accessed, no matter what I do. Strangely, if i replace the line of code to find an object on the web page of the non-active tab, it finds the object no problem.

Could you share your code?

import static com.kms.katalon.core.checkpoint.CheckpointFactory.findCheckpoint
import static com.kms.katalon.core.testcase.TestCaseFactory.findTestCase
import static com.kms.katalon.core.testdata.TestDataFactory.findTestData
import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject
import static com.kms.katalon.core.testobject.ObjectRepository.findWindowsObject
import com.kms.katalon.core.checkpoint.Checkpoint as Checkpoint
import com.kms.katalon.core.cucumber.keyword.CucumberBuiltinKeywords as CucumberKW
import com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords as Mobile
import com.kms.katalon.core.model.FailureHandling as FailureHandling
import com.kms.katalon.core.testcase.TestCase as TestCase
import com.kms.katalon.core.testdata.TestData as TestData
import com.kms.katalon.core.testobject.TestObject as TestObject
import com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords as WS
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI
import com.kms.katalon.core.windows.keyword.WindowsBuiltinKeywords as Windows
import internal.GlobalVariable as GlobalVariable

String clientsLink = “Object Repository/Page_Stratocast portal - Int1/span_Clients”
String numDevices = “Object Repository/Page_Stratocast portal - Client accounts/a_0”

String integratorLink = “Object Repository/Page_Stratocast portal - Cloud administrators/span_Integrators”;

WebUI.callTestCase(findTestCase(‘Portal - Account Management/Admission Authority - Login - Organizational Account’), [:], FailureHandling.CONTINUE_ON_FAILURE)

//Select Integrator links







def monitorCamera(){
WebUI.click(findTestObject(‘Object Repository/Page_Stratocast portal/canvas_Click or drag a camera thumbnail onto a tile to view it_vjs-tech vjs-tech-canvas’))

Your code looks incomplete. It would not function as you want.

I found 2 points.

(1) not a Custom Keyword

You have this:


def monitorCamera(){
	WebUI.click(findTestObject("Object Repository/Page_Stratocast portal/canvas_Click or drag a camera thumbnail onto a tile to view it_vjs-tech vjs-tech-canvas"))

A function monitorCamera is defined in the test case script, not as a custom keyword. Then you should write:


def monitorCamera(){
	WebUI.click(findTestObject("Object Repository/Page_Stratocast portal/canvas_Click or drag a camera thumbnail onto a tile to view it_vjs-tech vjs-tech-canvas"))

(2) “playIcon”

You have this:

def monitorCamera(){

The variable playIcon is not declared.

Please use CODE BLOCK formating when you make a new post.

スクリーンショット 2020-11-30 11.00.05

The monitorCamera function comes from a custom keyword as shown below. There is nothing wrong with the script.

And below is the settings for the object.

What is strange is that any object in that browser window cannot be accessed. If there is the same object living in the browser window of the inactive 1st tab, the script will select that object. But not the object from the 2nd active tab.

Your project looks complicated enough. It is difficult for me to understand your case, sorry.

what is it that you do not.understand?? i have a script.that opens web browser, creates accounts, creates a camera, clicks on a.camera. Up until here everything is fine, until the point where the 2nd tab.opens.after clicking on the camera. Is there.something.else.that you need from.me.to.move forward with this? We have tried other tools.and.have not.had.any issues with this.


This sounds like you have multiple tabs opened. Have you tried to switch to the new window before continuing the execution ? Otherwise, the script will continue to interact on the old tab, which sounds like what you’re experiencing.

Ok, that seemed to have worked with switching to the URL. But i am not understanding why we need to switchToUrl (or tab) since the tab is already the active one, why would we need to do that??