Switch tab
Move the run to another open tab, found by its address, its title or its position.
Only in
WarpX Browser
Use it after a click opens a new tab or popup, such as a sign-in or payment window, and when you need to go back to the first tab afterwards. The blocks after it act on the tab it finds.
Settings
- Find tab by
How to pick the tab. Match patterns finds it by address and Tab title by title. Next tab and Previous tab move one tab along, in the order the tabs were opened, and wrap around at the ends. Tab index picks a tab by its position.
ExampleMatch patterns- Match Patternswhen Find tab by is Match patterns
The address of the tab to switch to, with
*for any text.https://*.example.com/*matches the site and its subdomains. A pattern without a scheme, such as*checkout*, is matched against the whole address.Examplehttps://accounts.example.com/*- Tab titlewhen Find tab by is Tab title
The tab's title, with
*for any text. It is matched against the whole title, and case does not matter, so*checkout*findsCheckout - Example Shop.Example*Checkout*- Create if there's no matchwhen Find tab by is Match patterns or Tab title
When no open tab matches, opens a new tab at New tab URL and switches to it instead of failing.
ExampleUnchecked- New tab URLwhen Create if there's no match is ticked
The address for the new tab. It must start with
http.Examplehttps://accounts.example.com/login- Indexwhen Find tab by is Tab index
The tab's position, counting from
0, in the order the tabs were opened.0is the first tab of the profile's browser and1the second. A number with no tab behind it makes the block fail.Example1- Set as active tab
On: the tab is brought to the front of its window, if something else covers it. A tab that is already visible is not raised again. Off: the run moves to the tab, but what the browser shows stays as it is.
ExampleChecked- Delay time (ms)
How long to wait after the block finishes, in milliseconds. Write a range such as
1000,3000to pick a random wait in it each run.Example500
Every block also has the shared block settings — a description, Disable block and what to do on an error. Fields that take text accept data from earlier blocks.
What it hands on
Leaves by its single output. The block's result is the address of the tab it switched to. With Match patterns or Tab title, it fails with no-match-tab when no tab matches.
Example: Sign in through a popup, then return to the shop
- Start
- Open URL
- Click element
- Switch tab
- Type text
- Click element
- Switch tab
- Get text
- Add Click element with the selector
button.sign-into open the sign-in popup. - Add Switch tab. Set Find tab by to Match patterns and Match Patterns to
https://accounts.example.com/*. - Add Type text to fill the email field, with the text
{{variables.email}}, then Click element on the popup'sbutton[type=submit]. - Add a second Switch tab with Match Patterns set to
https://shop.example.com/*to go back. - Carry on in the shop, for example with Get text on
.account-name.
Good to know
- A new tab can take a moment to reach its address and title. With Match patterns or Tab title, the block keeps looking for up to 5 seconds before it gives up.
- When several tabs match, it takes the one opened first. If the tab you are on also matches, you may stay on it, so make the pattern specific.
- Next tab, Previous tab and Tab index count every page open in the profile's browser, including ones the workflow did not open. Closing a tab moves the tabs after it down one place.
- After the switch the run starts at the top of that tab's page. A frame chosen earlier with Switch frame is forgotten.
See also
- Open URL — Load a web address in the current tab or a new one, and wait for it to load.
- Get tab URL — Read the address of the current tab, or of every tab that matches a pattern.
- Close tab/window — Closes the tab the workflow is using, the tabs that match a pattern, or every window.
- Switch frame — Run the blocks that follow inside an iframe, or go back to the main page.