Highlighted
Absent Member.
Absent Member.
500 views

TruClient Tab Count

Is there a way to count the number of tabs that are open in IE 11 using Truclient?

0 Likes
2 Replies
Highlighted
Absent Member.. Absent Member..
Absent Member..

Re: TruClient Tab Count

Hi,

Anyone have a reply for this? I would like to know if there is any way to count the number of tabs that are open in firefox?

0 Likes
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: TruClient Tab Count

Hi,

There is no built-in function for that.

Here is a workaround to get this number. I tested it on Firefox and TruClient IE.

var numOfTabs = 0; // Initialize the number of tabs to zero in Evaluate JavaScript step

For (var i=1; i < 100; i++){  // Use TruClient For step from the Toolbox
   Activate tab i                // Use Generic Browser Action step and change the action to Activate tab in the i place
   Catch Any error           // Use Catch step to capture any error
       Break                        // The catch step will be triggered when TruClient will try to activate a tab that does not exist
   numOfTabs=i;            // Evaluate Javascript step again. If we reached this point it means that activate tab succeeded and we can count it for later use
}

If use this workaround you will need to activate a specifc tab after this loop in order to ensure the script continues to run successfully

Regards,

Shlomi

The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.