How to click an object with a dynamic name?

I am trying to click an object whose name is span_<today’s date>_. Obviously I don’t have it in the object repository. Can I click it nonetheless ?
Thanks in advance.

There should be other attributes that you might be able to use and give a unique path to the element. Saying that, we would need to see some HTML to guide you further on that.

And, you could theoretically create a String variable that contains “today’s date” and use it to click on your element. There are other forum Q & A on that for you to find.

How about:

Although you can create an element that is housed in the Object Repository, I don’t do that below. Instead, the below makes the object in code and then clicks on it.

import com.kms.katalon.core.testobject.TestObject as TestObject
import com.kms.katalon.core.testobject.TestObjectProperty as TestObjectProperty
import com.kms.katalon.core.testobject.ConditionType as ConditionType

Date todaysDate = new Date()
def today = todaysDate.format("yyyyddMM")  // put your necessary date format here

TestObject spanTo = new TestObject()

elementName = "span_${today}_"
xpath = "//*[@name='${elementName}']"
spanTo.addProperty("xpath", ConditionType.EQUALS, xpath)

Thank you, I’ll try that.