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
  • What is an iframe?
  • How to Use the Switch Frame Building Block
  • Returning to the Main Page
  • Nested iframes
  • FAQ

Was this helpful?

  1. Using ZeroWork
  2. Using Building Blocks

Switch Frame

PreviousGo Back or ForwardNextBrowser Alert

Last updated 5 months ago

Was this helpful?

The Switch Frame building block is here to help you interact with web pages that use iframes. But first, let's understand what an iframe is and why you might need to switch to one.

What is an iframe?

An iframe (short for inline frame) is a window within a web page that essentially embeds a different page within the main page. Many websites use iframes to load parts of their content separately, like forms, ads, or other embedded content. The challenge with iframes is that they act as a separate browsing context, meaning you can’t interact with the elements inside an iframe directly unless you "switch" into it.

In the example below, you can see a different website embedded into a web page.

How to Use the Switch Frame Building Block

  1. Identify the selector of the iframe. (More about selectors: Using Selectors.)

  2. Select "iframe" in the dropdown and enter your selector.

Once you've specified the iframe, TaskBot will enter that context. From now on, all following building blocks will operate within this iframe until you tell TaskBot to switch back.

Tip! It's recommended to increase selector timeout in the building blocks that rely on selectors (such as Save Web Element, Hover Web Element, etc.) whenever those actions take place within an iframe. You can find the timeout input field in Selector Options directly in those building blocks.

Returning to the Main Page

To go back to working on the main page, add another Switch Frame block and select "Main frame" in the dropdown. This action makes TaskBot exit the iframe and resume actions on the main page.

Nested iframes

Some web pages contain iframes inside other iframes. If you need to interact with elements within these layers, you can add several Switch Frame building blocks in sequence to navigate to the nested structure. TaskBot will follow each iframe level you define, so you can reach even deeply embedded content.

FAQ

What happens if the iframe is removed or changed while TaskBot is running?

If TaskBot cannot find the iframe, it will issue an error and stop.

What happens if I use the Open Link building block to open a new website, or the Switch Tab or Close Tab building block to activate another tab?

The frame setup will be cleared, as if you had used the Select Main Frame action right before the new tab becomes active. (This handling is available in the upcoming agent 1.1.56.)

How do I get a selector for the iframe or for the element inside it?

Usual ways to obtain selectors continue to work within an iframe. You do not need any special way to find a selector within an iframe or for the iframe itself. For example, if you use a selector picker extension to get selectors, just keep using it.

Troubleshooting: TaskBot can't click (or perform some other action) the element in the iframe!

The reasons why the element cannot be identified can vary:

  • You have not identified the right iframe selector, so your TaskBot is in the wrong iframe.

  • Your iframe selector is correct but it is inside another iframe. (See "Nested iframes" example in the section above.)

  • You have not identified the right click web element selector.

  • Add a longer selector timeout when performing actions on elements within iframes. (You can find timeout in Selector Options inside those building blocks.)

🏗️