Count class in web

Hi everyone,

In my website have 5 class =“abc”

I want to count class=“abc”. Result = 5 (int)
I have a idea: Using element exist and idx=‘…’. After I use while and count class =“abc”.

But, I made a mistake.


Can you share your workflow? What error are you getting?
Alternatively you can use get Children (and filter with class=‘abc’)

Hey @longnt23

If all the elements that you are trying to find has class attributes with value as ‘abc’ then as @Magali_Philippe said, You can use ‘Find Children’ activity with filter as <webctrl class='abc'> and target set to a tag that may have all those elements (e.g. Body of the page).

Output of this will be IEnumerable which you can store in a variable (e.g. elements) and then using elements.Count.ToString should give you the number of identified elements matching the filter.

Try changing the ‘Scope’ property to ‘Find_Children’ or ‘Find_Descendents’ if all the elements are not captured.

Let me know if it works. :slight_smile:

Rammohan B.

Thank @Magali_Philippe!

Thank @Rammohan91!