Dynamically get the number from the last div[], count div elements

For the given XPATH – /html/body/div[1]/div[1]/section/main/div[1]/div[1]/div[1]/div[1]/section/div[3]/div[1]/div[1]/div[2]/div[1]/div[1]
I need to count the number of fields. Those fields are div elements inside a parent div. The only thing changing in the XPATH is the number inside the last div /div[number] That number shows the correct number of fields I need to count.
As an Action I’m using Count Elements.
In the screenshot below you can see all the fields that I need to count.

My question is: How can I dynamically get the number from the last div which equals the total number of fields?

looking forward to answers on this

1 Like

You can count the elements by changing the locators,
Try to follow this sequence:

Let me know if you managed.

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