DocsBrowserSwitch Tab

Switch tabs in background Chrome (CDP)

Browser ModeRunMacro 3.5+

The Switch Tab command moves the background Chrome focus to a tab by its index (starting at 1).

Dialog & quick setup

RunMacro Switch Tab command configuration dialog showing parameter fields
Configuration dialog and parameter fields for the Switch Tab command in RunMacro.
  1. In Browser Mode (CDP), add the Browser › Switch Tab command.
  2. Enter the tab index (1 is the first tab).
  3. Save and place it before the actions that should run on that tab.

Options reference

Tab index

The tab position counting from 1 (left to right). E.g. 2 is the second tab.

Modes & when to use

Browser Mode

Best for

  • After opening several tabs, select the right one to act on.
  • Return to the original tab after opening a side tab.
  • Alternate work between tabs.

Use an alternative when

  • Do not use it with unstable title/URL targets or multiple matching tabs without disambiguation.
Before you run
  • Add Switch Tab to the macro.
  • Prepare the data or target that Switch Tab will use.

Example workflow

Example: work on the 2nd tab

  1. Open a New Tab (becomes tab 2).
  2. Switch Tab → 2.
  3. Run Smart HTML on tab 2.
Expected result: After execution, Switch Tab completes the described action and makes its result available to the next step.

Tips & limitations

If the index is greater than the number of open tabs, the command errors out and stops (it does not pick another tab). An index below 1 is clamped to tab 1. Make sure the target tab is open before switching.
  • A tab can close/change URL between lookup and switch; broad criteria can activate the wrong tab.

Applies to RunMacro 3.5+ · Browser Mode · Windows 10/11

RunMacro robot

Robots do the work. Your time is yours.

Create a robot in minutes, no coding needed. Reliable execution, remote management, transparent costs — and you always stay in control.