Dynamic Objects How to Make

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.

1 Like

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.

1 Like

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

1 Like

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”)’])]

1 Like

1 Like

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"]))

1 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?

1 Like

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

1 Like

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.

1 Like

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.

1 Like

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.

1 Like

1 Like

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?

1 Like

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?

1 Like

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”

1 Like

I agree with you. It IS crazy.

1 Like

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})]

Why not you try it yourself.