What is the easiest method to access element

I am trying to find a way to automate a repetitive task on this page:

The test is:

selenium.click("//tr[2]/td[2]/a")
selenium.click("link=Edit")
selenium.select("name=timeEnabled", "label=Yes")
selenium.click("name=submit")
selenium.click("link=Projects")

I need to then iterate to the next row (first line in the test):

selenium.click("//tr[3]/td[2]/a")

And so on until element not found.

Is there a way to do it with the help of the recorder only? What is the easiest way of doing?

@konstantin.korneev

Hi, please open the following test suite with Katalon Recorder

Loop over items test suite.html (1.4 KB)

It will look as followed:

Replace the step in grey with your steps (clicking, selecting, etc). It essentially loops from 1 to 5, replacing the value 1 to 5 into the locator, and click the element identified by that locator.

Instead of //tr[3]/td[2]/a, use //tr[{i}]/td[2]/a

If you don’t know how many items you need to loop over, try set it to 1000 or something.

1 Like

That’s exactly what I needed, thank you so much!

1 Like