How to count the number of tabs opened?

Hi, I’d like to force the scenario before to begin with next steps in macro and I was wondering if there is a way to get the number of tabs opened. I haven´t found a command for that, only this thread. It is mentioned that are some ways to do it, but it wasn´t mentioned how.

Thanks in advance.

The internal variable ${!current_tab_number} tells you on which tab the macro is currently running.

Just to clarify: Do you need the absolute number of tabs open? Depending on why you need this, there are possible solutions.

Only with the absolute tab number I’m not able to know how many tabs are opened. I need to force the scenario to work only with 2 tabs. Info there are opened 4 tabs and the current selected tab is the 3rd one, then the absolute tab would give me 2, but that doesn’t tell me that actually are 4 tabs.

What if you close all tabs at macro start? Then we have ${!current_tab_number} = number of overall tabs.

You can use this command: selectWindow | tab=closeall . This command will close all tabs in the browser except for the current one.

I’ve been doing that so far, closing all other tabs and construct the scenario from the beginning, which involves some extra steps that wouldn’t be needed if I could get the number of tabs. I asked because it was mentioned that there are some ways to do it. Thanks for answer