Count number occurrences of an element in LeanFT

42 Views Asked by At

is there any LeanFT method that returns the number of an element? I wish to use it instead of the exists() method. Something like the following:

if(PageX.Node.closeTabButton.count() > 0)
   {
    ...
    Treatement
    ...
   }

I wanted to check if a type of bouton (Close Tab Button) exists on the page before starting a treatment, so I put that as a condition:

if(PageX.Node.closeTabButton.exists())
   {
    ...
    Treatement
    ...
   }

the exists() method seems not work because there is more than one closeTabButton elements on the page, that's why I'm looking for an alternative solution.

1

There are 1 best solutions below

0
Motti On

Instead of using a single object, you should use the parent's FindChildren with the description, then you can see how many elements exist.