How to set wildcard in object repository

How to set text value :
Text = (wildcard) select(wildcard)

1 Like

You have the boolean part of selectOptionByValue() correct in using true so that you can use RegEx (Regular Expression). So, to get a wildcard, you can use any Regular Expression “symbols”, like: \\D{4,8}, \\s, .*, \\d[2,5] and lots more. Look up RegEx for more.

So: Text = ".*select.*" might work.

Also note, I think you should have your boolean set to false unless you know you want to use RegEx, especially if you do not know what characters are a part of RegEx.

Example (comparing time part of datetime):

		gFormattedDate + "\\s\\d{2}:\\d{2}:\\d{2}\\s(A|P)M\\R", true)

Edit2: if you do actually want to use a wildcard within the Object Repository, then you need to review Parameterization.

I would have parameterized the xpath

 //*[@id='Ddl_Category'] and contains(text(), '${value}')]

note that the value is now parameterized, and you locate the select option on its xpath id, can also ba class as long as your starting point is xpath

a testcase call can be something like this

import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI

// The value you want to search for
String optionvalue = "Select value in the option list(combo or list)"

// Finding the test object with the dynamic value
TestObject optionselectbyval = findTestObject('Object Repository/DynamicSelect', [('value') : optionvalue])

// Perform actions on the found test object, e.g., verify if the element is present
WebUI.verifyElementPresent(optionselectbyval, 10)

good luck