Forum Discussion

NicolaFilosa_SE's avatar
2 years ago

Sum the length of variuos FindAll searches

Hi to everyone, I have to count the total number of elements present in a web page (see image). The total number is 7 and the only way to find them is to do FindAll 3 times, one for every name of the...
  • rraghvani's avatar
    2 years ago

    If I understand correctly, you want the sum to be 7, as you have 7 boxes? It will be something like,


    var Instrument_Sum = 0
    var Instrument = new Array("DR 4010 PT100", "TelevisIn", "TelevisGo")
    for (var i = 0; i < Instrument.length; i++) {
      var Instrument_Count = Equipment_Targets_List.FindAll("contentText", Instrument[i], 15, true).toArray()
      Instrument_Sum += Instrument_Count.length



    See Addition assignment (+=)