Dynamic Objects How to Make

Why not you try it yourself.

Thank you for this. This is going to be very helpful. :slight_smile:

Is there a way to try it without having to create the object again?

this is the result:
//[contains(text(),${DJ})][count(. | //[(text() = ‘${DJ}’ or . = ‘${DJ}’) and @class = ‘dj col-4’]) = count(//*[(text() = ‘${DJ}’ or . = ‘${DJ}’) and @class = ‘dj col-4’])]

Do you mean, you want to create a Test Object without using the Web Recorder or the Spy tool?

Yes, you can create/edit a Test Object in the Object Repository just manually one by one.

It seems that you ignored my previous post: Dynamic Objects How to Make - #7 by kazurayam

I guess I didn’t explain correctly. I dont know of a way to get an already captured test object back into the web spy and test it without having to create a new page in a new repository then relocate it to where I need it after having tested it.

I guess Im asking is there a way to sort of “right click/open in object spy” then click the verify and highlight button?

I don’t understand.
I have got tired.
so long.

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

The above it what it looks like now. Not sure why doing it like the video keeps putting it like this [(‘variable’): DJ]))

Thanks for your PM, but I’m not sure I can help here. And I have to say it, this thread is a rat’s nest, not least because…

  1. You’re using lengthy, unwieldy XPaths which are sure to cause problems for maintenance later (nod to @grylion54) and for us are difficult to read/approach.

  2. I think you’re using Katalon and supporting tools that most of us don’t use (Spy, Manual View, etc.)

Regarding #1, understand that we can’t see “everything” (your HTML, your JavaScript and CSS or even your page and what it’s meant to do). So having to read a ton of posts to pull it all together just to understand what’s going on, is an exercise in futility if not sheer boredom. How then are we meant to pull together an answer? I’m not surprised to see @kazurayam saying he’s tired and decided to check out. I don’t blame him – like I said, it’s a rat’s nest of a thread.

Regarding #2, it’s difficult for us to work this problem through with you because you’re coming at it it from a different place… a place we don’t generally work from. We use Script view. We write code. We generally build our own Test Objects, one by one (as mentioned up-thread). In my case, I don’t even use the Object Repository – if I need a Test Object, I create one dynamically in my test, and throw it away when I’m done.

So, having said all that, here’s my advice, for what it’s worth:

Build ONE Test Object BY HAND (with an XPath you wrote yourself) and write ONE Test Case to prove your one Test Object works correctly.

Now BREAK the XPath (spell the id wrong, for example). Run the test again. Prove it is broken in the way you expect.

THAT is sound engineering. Until you can do that for ALL your Test Objects, you’re working in the dark, wishing for things to go your way and floundering when they inevitably don’t.

Lastly, don’t give up. Nothing I’ve said above is meant to stop you moving forward, I’m just trying to help you see a (new, better) way forward.

Finally, lastly, :wink: learn to use the Web developer tools built into the browser. You’ll gain much advantage by becoming proficient in their use.

Understood.

  1. I completely understand that this is a Forum and not an educational site. I do not expect that all of my issues with trying to learn an entirely new system / career will be answered here.
  2. I have read, and am still reading the document from @kazurayam XPath in Selenium: How to Find & Write Text, Contains, OR, AND Thank you for that it is already helping.
  3. I have no formal training (if it exists in this application), learning as I go from YouTube, and wherever else I can get information.
  4. There does not exist training on writing xpath in Katalon Academy. Is there a source that you would recommend where I can learn this?
  5. Everything I have written was done in script mode, excl. me trying to follow the video referenced above regarding variable insertions.
  6. Are there recommended places to learn how to create test objects in the fashion you mentioned?, prior to your mention I did not know you could do this. I thought the only way was what I had seen through the katalon videos.

Lastly,
I would like to thank all of you for your help with my “stupid” questions. All of you here have shown more support for this product then I have been able to find anywhere else. If you have recommendation on where I can locate and take training related to this program, I am more than looking forward to increasing my knowledge base.

1 Like

You know what I’m going to say, right? :slight_smile:

Seriously, there are very very few stupid questions. Politeness prevents me from showing you all the stupid answers I see :wink:

Here’s the thing… Katalon is a pretty vast tool. Getting noobs on board with the toolset and the terminology is a huge challenge. That’s where you find yourself right now. Ironically, “somewhere in there” (in your posts) is a great question, totally valid concerns we’d like to help with. But due to your relative inexperience, and your lack of understanding at this point, it’s hard to know where and when you’re making mistakes and errors and even harder to know if your definition of terms (e.g. “variable”) is the same as ours (that’s just an example, and possibly not a very good one). Honestly, I read some of this thread and shook my head, thinking, “where do I even begin”? Then I stopped reading and posted my response above.

However…

None of this is your fault

To your point about the videos (and, I’ll add, the toolset) – these are to aid non-technical, non-programmers to get up and running with KS as quickly as possible. Do they do a good job? That’s for you to decide. I made my decision a long time ago – but I’m a seasoned programmer (with scars to prove it).

So, here’s the problem in a nutshell. YOU are asking technical, quite in-depth questions but using toys to create your Tests/Test Objects. You clearly want to know “what’s really going on” but using tools that prevent you from doing so. Spy for example will build a wall of Test Objects in your Object repository giving you a maintenance task down the road you’ll hate. Worse than that, once you have them, hundreds of them, you dare not tocuh them in case something breaks! Totally understandable when you’re a noob!

The only way to remove that fear is to TAKE CONTROL and build your own Test Objects. Use DevTools to investigate your web pages. Learn the structure of the HTML DOM. Use Script View and learn to love it.

Lastly, this is how I create a Test Object dynamically, in memory. It’s a custom keyword which I suspect is a little further down the road from where you are right now, but keep it in mind for the day you’re ready…

Creation of Test Object in Memory at Runtime

Note, if you want to use XPath instead of CSS, change the code to say xpath wherever it mentions css.

Yes understood