TestProject Forum

Create New Steps based on Elements which changed each day

Hello :slight_smile: ,

I’m creating a step, choose the action, name the element and give it the element path everything is fine.

Then I duplicate that step and simply change the element name and the path, its working well.

But my elements are getting changed from day to day.

I have many Elements (apps in that case) which I’m getting new Elements(apps) each day…
Meaning - Each day I’m getting new elements to that web page.

My question is:
If I want that the test will know in advance how many elements I have in the page?
After he found all the elements: successes:
Xpath : //div[]/div[2]/div[]/div/div/div[@class = ‘card-subtitle fs-exclude’]

This is the result:

I have found all the relevant elements.

I need to click each 1 of them → download a report → go back to main page.
Click the 2nd → download a report → go back to main page.
Click on the 3rd → download a report → go back to main page.
Click on the 4th…
Click on the 5th…
Click on the 28th…
Click on the 29th.

I succeed to do that test manually … when I chose in advance all the 29 elements but I want that the system will get it dymanic… it is poosible? someone can help here with an idea?

Many thanks in advance, hope my question is clear,


Hi @ornexa .

Yes, you can definitely do that.

The first step will be to identify the number of elements by using the action “Count Elements” .

You need to put the type of the element to find. In you case, you can use the XPATH that you already found that matches all elements you want.

In this step, add a Project parameter for the OUTPUTS:

Then, to click on the elements that you want, you have to add a click step using a dynamic locator, like this:

[FYI: you can read more about dynamic elements here :How to create dynamic elements in TestProject | TestProject Help Center ]

The third step would be to perform a mathematical action to reduce -1 each iteration and put the new value in the same parameter:

  • Then you can add any steps you want.

  • Finally, we will group these three(or more) steps as a test, Highlight the steps and click on Group step into a Test.
    (I suggest to duplicate all steps before grouping them since there is no option to ungroup)

And this is the test that was created:

Now, we have to open this test and define 2 things:

  1. A loop: go to REPEAT field and define the max iteration(it’s related to the number of elements that are supposed to be present, but there is no problem if you put 100).
  2. A condition: the parameter is greater than 0 the test will run

The test won’t run all the repetitions since once the parameter is equal to 0 the iterations will stop .

In this example, the test will repeat up to 20 iterations and no more than the number of elements found.

Let me know if this has given you the solution you are looking for.
If you need any help, feel free to contact support clicking on this icon:

Kind regards,

Hey Ricardo,

Thank you so much for the help!!

Appreciate it,

Happy to help :slight_smile:

This topic was automatically closed after 22 days. New replies are no longer allowed.