Forum Discussion

qanhd's avatar
qanhd
Occasional Contributor
15 years ago

How to get total number of tab in Firefox

Hello,



Can you please show me how to get the total number of tab(s) in Firefox, for one and multiple firefox process opening?  I would prefer not to use Page index since url can be different at times.



I am using firefox 3.5.6, TC 7.51.667.7



Thanks in advance.

1 Reply

  • Hi Anh,


    You can use the following code:


    [JScript]


    function sample()

    {

      var firefoxProcesses = VBArray(Sys.FindAllChildren("ProcessName", "firefox")).toArray();

      Log.Message("There are " + firefoxProcesses.length + " Firefox processes running in the system.");

      for (var i = 0; i < firefoxProcesses.length; i++)

      {

        var pagesCount = VBArray(firefoxProcesses.FindAllChildren("Name", "Page*")).toArray().length;

        Log.Message("Process #" + i + " has " + pagesCount + " pages opened.");

      }

    }