IMPORTANT : How to read objects from Katalon object repository in a Keywords code

Hi,

I would like store below object information in Kalon abject repository and read into custom keywords. How can we do this?

I am trying to map objects from object repository into custom keyword code.

Sample code mentioned below.

@Keyword

public void getApp() {

Thread.sleep(5000);

driver.context(“NATIVE_APP”);

Thread.sleep(5000);

driver.findElement(By.xpath(“//*[@class=‘android.widget.EditText’]”)).sendKeys(“2335”);

driver.findElement(By.xpath(“//*[@class=‘android.widget.EditText’]”)).sendKeys(“D569”);

driver.findElement(By.xpath(“//*[@class=‘android.widget.EditText’]”)).sendKeys(“2A16”);

driver.findElement(By.xpath(“//*[@class=‘android.view.ViewGroup’]”)).click();

driver.findElement(By.xpath(“//*[@text=‘’]”)).click();

}

Example -

driver.findElement(By.xpath("//*[@class='android.widget.EditText']")).sendKeys("2335");

In above code, I wanted to store the XPath information into Katalon object Repository and make the reference into this code smilier to how we refer to manual test mode.

Please help me on this…

@“Vinh Nguyen”

Could you please answer for this?

You can store that Xpath into a Katalon object that use below function instead:

WebUiCommonHelper.findWebElement(findTestObject(path), 30)

Thanks for your reply.

WebUiCommonHelper.findWebElement(findTestObject(path), 30)

This would work for WebUI. But, how it can be for Mobile tests?

Well in Mobile it will be like this:

import com.kms.katalon.core.mobile.helper.MobileElementCommonHelper
MobileElementCommonHelper.findElement(findTestObject(path), 30)

Thanks, I again. I will try these options. By the way, when is the next Katalon new release planned. I am hoping many new things would be coming :slight_smile: