Looking for alternative of creating objects to locate the element

Hi There,

I am new in Katalon family and looking for a solution.
I want to automate a application which has many fields/objects to verify and all the time I have to create an object for each element to verify which is very tedious and time consuming task, recording option is disable in my organization, so could you please help me to find any alternative where I can easily locate a element through script and no need to create an object for each element.

Thanks in advance!

Hi @roopali.phapale,

I am one user of Katalon, hope I did understand your full context. I guess that your situation is to reduce effort to create Test Object because sometime, we can create one Test Object and use for different Objects in the Web Sites

Imaging that we have the page like below screenshot:

Normally, We need to verify GUI, we create 3 Test Objects (3 buttons in the screenshot) then verify them existing in the script.
For this case, we can create one object only, then passing object name to verify it. Below is the steps

  1. Create one Test Object
  2. Identify the xpath rules of related Test Objects. In the screenshot, 3 buttons just different about the text

xpath: //a[normalize-space(.) = ‘Make Appointment Tomorrow’]

Other buttons have the same structure, just change the text

So, we define a template of xpath which button’s text is stored in one variable

//a[normalize-space(.) = ‘${buttonName}’]

In your test script, just provide the value of the button name via the variable, example:

lstButtons = [‘Make Appointment Tomorrow’, ‘Make Appointment’, ‘Make Appointment Yesterday’]
lstButtons.each{
WebUI.verifyElementPresent(findTestObject(“Object Repository/New Test Object”, [“buttonName”: it), 30, FailureHandling.CONTINUE_ON_FAILURE)
}

Note: buttonName is the variable you defined in Test Object

With this approach, if your real Object need 2-3 or more variables, using the same ways

Hope it is useful

FYI.

This is precisely what makeTO() was designed for.

https://docs.katalon.com/katalon-studio/docs/manage-web-test-object.html#creation-of-test-object-in-memory-at-runtime

If you want to use xpath, just change all css references to xpath.

If Recorder is locked down, can you use Spy?
I guess the reason for restricting Recorder is so that you end up with better quality code, hopefully? Just interested in the QA thought process.