How to use testobject within selenium code

Hi there,
I am new to this tool and started using it recently. Please be patience if my question is already answered.
I have defined the testobjects in the object repository. In my script I need to use them with selenium code
Ex. I have WebUI.mouseOver(findTestObject(‘Page_Home Agency Refresh/h2_Featured Careers’))
“selenium code”
List FeaturedJobsList = driver.findElements(By.cssSelector(‘’))

in the above code instead of I redefining the object by cssselector I want to refer to the test object that I have used in WebUI line something like
List FeaturedJobsList = driver.findElements(‘Page_Home Agency Refresh/h2_Featured Careers’)

You can find the source of com.kms.katalon.core.testobject.TestObject class.

Please mind that the version of this source is not disclosed so that I am not sure if it is up to date or not.

By reading this, you would be able to find several ways how to inspect the internal of this class. In the end you may find a way to extract the CSS Selector out of the TestObject. Once found, you would want to pass it to the driver.findElements(By.cssSelector(....)) part.


It is strange enough that the published Javadoc of Katalon

does not include the com.kms.katalon.core.testobject.TestObject class.

Does Katalon Team want to intentionally hide it from public view?

WebUiCommonHelper has functions to get a WebElement from TestObject and back

Thanks for your reply, I used as follow and its working for me

List numOfFeaturedJobs = WebUI.findWebElements(findTestObject(‘Page_HomeCIA/Featuredjobslist’),10)

It’s probably due to the API were still in development when the docs are published. I will escalate to the team. Thanks !




WebDriver driver = DriverFactory.getWebDriver()

driver.findElement(By.xpath(findTestObject('SIT_Login_Page/UserName').findPropertyValue("xpath"))).sendKeys("User_Id")  // WORKING