Repeat steps with using different objects

hi everyone please help with this question. i would like to repeat several steps in a test case but when the loop happens i would like step 8 to use a different object. so. after step 11 it would start at step 7 and click a different object. step 8’s object is basically a hyperlink. so would i have to save all the objects, or is there a way to enter the id #'s into a data driven file and pull from there on the loop?

Hi @j_berg72

Hi, may I see the details of the Test Object of step #8 ?

The idea is that you would parameterize your Test Object, which means instead of using a specific number in the locator such as:


You would do something like this (in the Selected Locator field in your test case


Then in the test case using this object, you can write something like this

def values = ['1111','2222','3333','4444'];
// Looping over the array declared above, and with each value
for(value : values) {
    // Find the test object, pass the value inside it, and then click on it'your Test object Id', ['id': value]));

That’s the general idea. Please try to apply it to see if there’s any difficulty.

yes here is the details of test object in step 8. if i change the text to the specific id, it will grab it. my goal is when it loops grap the next id. but i cant figure how for it to pull the next ID when it loops for the second, third, so on so forth…

so my script would look like this, but what do i enter in quotes next to for

also i can’t change the selector locator unless its set to xpath. what would be entered here?