Dynamic Objects How to Make

Trying to make a dynamic object, or an object that changes its locator value? I dont know… all of the objs that I am trying to locate use the same information before them but they all have a different text contained within that I am hoping to use to identify and click on the obj with.

What I am trying to do???

Caused by: com.kms.katalon.core.webui.exception.WebElementNotFoundException: Web element with id: 'Object Repository/097/Page_Final Assembly Manager/div_78797172' located by 'id("mat-tab-content-2-1")/div[@class="mat-tab-body-content ng-tns-c774-64 ng-trigger ng-trigger-translateTab"]/fam-wip-card[@class="ng-star-inserted"]/div[@class="card-container ng-star-inserted"]/mat-card[@class="mat-card mat-focus-indicator wip-card container selected"]/div[@class="row dj-row align-items-center"]/div[@class="dj col-4"][count(. | //*[@class = 'dj col-4' and (text() = '${DJ}' or . = '${DJ}')]) = count(//*[@class = 'dj col-4' and (text() = '${DJ}' or . = '${DJ}')])]' not found

Basically how do I use this?

//[contains(text(), ‘${Employee}’)]
//
[contains(text(), ${Employee})]
//*[contains(text())=’${Employee}’]

Like this?
//[@class = ‘dj col-4’ //[contains(text(), ‘${DJ}’ or ., ‘${DJ}’)])

Please show us the line in your test case that calls findTestObject().

Why I ask this? Let me explain. In the doc,

tells that you need to pass value of the variable as a parameter to findTestObject(), like

findTestObject('{your test object}', [('{property}') : '{value of property}'])

The ${property} variable will be interpolated with the value of property when executed.

Without this single line, ${property} variable will NOT be interplated. I guess, you are not passing the value to interpolate ${DJ} variable with. Your original post suggest that you have this problem.

I think it would be good to try to get a shorter xpath to your element also. The above pathway looks like it could get broken easily.
Maybe like:

id("mat-tab-content-2-1")//*[contains(text(), "${DJ}")]

You would have to test the pathway to ensure it was unique–for testing, substitute the text you wanted in the last part.

WebUI.click(findTestObject(‘Object Repository/097/Page_Final Assembly Manager/WIP CARDS’, [(‘variable’) : DJ]))

Like this??

id(“mat-tab-content-2-1”)/div[@class=“mat-tab-body-content ng-tns-c774-64 ng-trigger ng-trigger-translateTab”]/fam-wip-card[@class=“ng-star-inserted”]/div[@class=“card-container ng-star-inserted”]/mat-card[@class=“mat-card mat-focus-indicator wip-card container selected”]/div[@class=“row dj-row align-items-center”]/div[@class=“dj col-4”][count(. | //[(text() = ‘${DJ}’ or . = ‘${DJ}’) and @class = ‘dj col-4’ and @id = ‘id(“mat-tab-content-2-1”)’]) = count(//[(text() = ‘${DJ}’ or . = ‘${DJ}’) and @class = ‘dj col-4’ and @id = ‘id(“mat-tab-content-2-1”)’])]

Not in this way.

You used a placeholder named DJ in your Test Object’s locator string.

You want to interpolate the DJ with some value.

So you would want something like this:

WebUI.click(findTestObject("Object Repository/097/Page_Final Assembly Manager/WIP CARDS",
     [("DJ") : "any value you like"]))

So I followed what a few of the videos showed and this was the result [(‘variable’) : DJ])) of doing it exactly like the video.

I thought that the variable part was my variable?? (DJ)??? but your saying I need to type in each number?? if so what is the point of the variable?

Man I wish there was a way to do video calls through forums…lol

Here is the video that I was referring to:

They are doing exactly what I want to do but I cant get my scenario to work.

I have done this one and it works great. But I also need to do almost the exact same thing with my objects, hence the dynamic objects video.

I have tried to locate my objects with text only just like the video but to no avail. I can verify that the text is there, but I am unable to click on the object.

I quickly checked the video “Web Testing - Handling Dynamic Test Objects”. It’s telling something correct.

Just you do not yet understand the technique.

Why not look at the video again?

So I watched that video about 15 times to get to where I am now… :(. I am unable to use text to locate these objs. so there has to be something wrong with how I am trying to locate the object. I mean how can I get it (Katalon) to verify that yes the text I am looking for is there, but nope you cant click on it.

This is specifically where my text resides
image
but I am unable to click on it and its gotta be because I am trying to find it the wrong way or something.

right now I am using this to locate:

id(“mat-tab-content-2-1”)/div[@class=“mat-tab-body-content ng-tns-c774-64 ng-trigger ng-trigger-translateTab”]/fam-wip-card[@class=“ng-star-inserted”]/div[@class=“card-container ng-star-inserted”]/mat-card[@class=“mat-card mat-focus-indicator wip-card container selected”]/div[@class=“row dj-row align-items-center”]/div[@class=“dj col-4”][count(. | //[(text() = ‘${DJ}’ or . = ‘${DJ}’) and @class = ‘dj col-4’ and @id = ‘id(“mat-tab-content-2-1”)’]) = count(//[(text() = ‘${DJ}’ or . = ‘${DJ}’) and @class = ‘dj col-4’ and @id = ‘id(“mat-tab-content-2-1”)’])]

but this seems crazy for me to have to type out every time, I need to do this more than 1000 times.

there needs to be an easier way to locate like //*class='dj-col-4 and text() = ${DJ}

am I crazy or am I just filling out this information wrong?

I think that the problem will be that the id? will change each time so I will need to locate using the text and the class, but i cant seem to do so.

id(“mat-tab-content-2-1”

I agree with you. It IS crazy.

Possibly yes.

But Katalon Studio can not automatically generate a neat locator string for you.

You need to learn XPath technology and manually write a concise and working locator for yourself.

Want to study XPath? Then have a look at:

Where ya from kazu?

So couldn’t I just use this? Xpath=//*[contains(text(),${DJ})]