ZeroWork
  • 👋Home and Welcome
  • 🚀Getting Started
  • ⬇️Install the Agent
  • 🧑‍💻Crash Course
  • Using ZeroWork
    • 🖥️General: Run, Schedule, Share, Webhooks
      • Run
      • Stop
      • Log in to the Agent
      • Run Modes
        • Run Incognito
        • Run Non-Incognito
        • Run in My Regular Browser
      • Run Settings
        • Run in Background
        • Stay on Page after Run
        • Bring Pages to Front
      • TaskBot Sharing Options
      • Cookies
      • Scheduler
      • Trigger Run via Webhook
      • Proxies
      • Remote (Cloud) Execution
      • How to Check and Update Your Agent
      • Install ZeroWork Agent on VPS
    • 📔Using Selectors
      • What Are Selectors
      • Use Element's Text
      • Copy Selectors
      • How to Build Custom Selectors
        • Basic Concepts of Selectors
        • One Element Can Have Many Selector Expressions
        • Check if Selector Is Correct and Unique
        • Exact or Loose Match
        • Hierarchy
        • Combine Filters with Standard CSS Logic
        • Lists: Incremental CSS Selectors
        • Addressing Siblings
      • How to Use XPath in ZeroWork (advanced)
    • 🏗️Using Building Blocks
      • Open Link
      • Save Page Url
      • Switch or Close Tab
      • Go Back or Forward
      • Switch Frame
      • Browser Alert
      • Click Web Element
      • Check Web Element
      • Save Web Element
        • Save Lists
        • Enrich Existing Data
        • Stop Run If Selector Is Not Found Option
      • Insert Text or Data
      • Hover Web Element
      • Select Web Dropdown
      • Keyboard Action
      • Start Condition and Set Condition
        • Actions = & ≠
        • Actions <, ≤, >, ≥
        • Data Found & Data not Found
        • Contains & Does Not Contain
        • Before (Date) & After (Date)
      • Start Repeat
        • Standard Loop
        • Dynamic Loop
        • Continue until No Element Is Found
        • Auto-Scroll
        • Auto-Continue from Last Row or Element
        • Nested Loops - Handle Pagination
      • After Repeat
      • Break Repeat
      • Try-Catch
      • Raise Error
      • Abort Run
      • Update Data
      • Number Operations
        • Example: Standardize different formats
      • Format Data
        • Remove Words
        • Shorten Content Length
      • Split Data
      • Apply Regex
      • Remove Duplicates
      • Delete Data
      • Ask ChatGPT
      • Send Notification
      • APIs: Send HTTP Request
      • Write JavaScript
      • Save File
      • Upload File
      • Delay
      • Record Date
      • Take Screenshot
      • Save from Clipboard
      • Log
      • Building Block Options
        • Delay Times between the Building Blocks
        • Randomize Delay Time
        • Deactivate Building Blocks
        • Shortcuts
        • Spintax
        • Auto-Align
        • Sticky Notes
    • 🔀Using Variables
    • 💿Using Tables
      • How to Add Tables
      • Native Tables
      • Google Sheets
      • Import Data from CSV
      • Using Google Sheet vs. Native Tables
      • Create Columns
      • Export Data as CSV
      • Convert Native Table to a Google Sheet
    • 📄Using Run Reports
    • 😑Common Problems
      • My TaskBot Does Not Start Run
      • When I Use Data from Table, No Data is Being Pulled
      • Website is Glitching and Flashing
      • No Selector is Found
      • My TaskBot Saves Some Data but Not All
      • Data Is Saved in Wrong Format
      • Website Requires SMS or Email Verification
      • Keyboard Action Is Not Working As Expected
      • Check Web Element Identifies Selector as Found but Next Action Does Not
      • When Using Insert Data Block, First Letters Are Cut Off
      • Workflow Has More than One Starting Building Block
      • TaskBot Does Not Automatically Scroll
  • Support
    • 🆘Getting Support
  • 🆕Release Notes
    • Version 1.1.61
    • Version 1.1.62
    • Version 1.1.63
    • Version 1.1.64
    • Version 1.1.65
    • Version 1.1.66
    • Version 1.1.67
    • Version 1.1.68
Powered by GitBook
On this page
  • Options
  • Actions

Was this helpful?

  1. Using ZeroWork
  2. Using Building Blocks

Switch or Close Tab

PreviousSave Page UrlNextGo Back or Forward

Last updated 5 months ago

Was this helpful?

The Switch or Close Tab building block allows you to:

  • Switch to a specific tab using different criteria.

  • Close a tab.

Options

  • Latest tab: Switch to the last tab on the farthest right.

  • Previous tab: Switch to the tab directly to the left of the current tab.

  • Next tab: Switch to the tab directly to the right of the current tab.

  • Tab URL matching: Match a tab based on its URL or part of it. If there are multiple matching tabs, the first one will be picked. Examples:

    • A full URL (e.g., google.com).

    • A partial URL (e.g., /subpage).

    • For advanced matching: A regular expression entered between slashes with or without a flag (e.g., /^https:\/\/google\.com$/i or /^https:\/\/google\.com$/). If your regular expression is invalid, no error will be thrown and TaskBot will assume it is a non-regex value. To ensure that your expression is correct, use regex validator beforehand (e.g. ).

  • Tab number: Switch to a tab by its position in the browser. For example:

    • Tab number 1: First tab on the farthest left.

    • Tab number 2: Second tab from the left, and so on.

Be cautious with options other than Tab URL matching. TaskBot determines the order of tabs based on their creation time. If you manually rearrange tabs during the TaskBot's run, the tab number may no longer match the visual order displayed in the browser.

When using the Run in my regular browser run mode, the order of the tabs cannot be guaranteed due to parallel TaskBot runs within the same context, as well as the presence of your own tabs. Prefer using the Tab URL Matching option instead.

Actions

1. Switch to Tab

Switch to a tab based on the criteria described above.

2. Close Tab

Close a specific tab based on the criteria described above.

What happens if a currently active tab is closed?

If you close the currently active tab:

  • The next tab to the right will become active.

  • If no tabs exist on the right, the next tab to the left becomes active.

  • If no tabs remain, the browser application will close.

If the tab that is closed is not active, the active tab will remain as it is.

If this default behavior does not meet your needs, you can add another Switch or Close Tab building block to define which tab should become active.

If the browser application closes because all tabs are closed, TaskBot will continue running. However, if subsequent actions require a browser (such as a Click Web Element building block), TaskBot will stop, generate an error, and report the run as failed. To prevent this, you can add an Open Link building block to re-launch the browser.

🏗️
https://regex101.com/