Switch Frame

The Switch Frame block moves your TaskBot into an iframe so the blocks that follow act on the elements inside it.
How To Use It

Iframe (default) enters an iframe. Provide a selector for the iframe element (see below).
Main page leaves every iframe and returns to the top-level page.
Web Element Selector
When the target frame is Iframe, enter the CSS or XPath selector that identifies the iframe element on the page; it's the same kind of selector you'd use in other Web Interaction blocks. See Using Selectors.
Timeout
How long to wait for the iframe element to appear before the block fails, in seconds. The default is 15 seconds. Raise it if the iframe is slow to load.
Block-level Delays
Min sec and Max sec represent a pause after this block's action completes, before the next block runs. The wait is randomized between the two values, and setting both to the same number makes it fixed. This block defaults to 0, meaning no pause.
Things To Know
Switching into an iframe affects blocks after it. Once you switch into an iframe, every selector-based block after it (Click Web Element, Save Web Element, Hover Web Element, Check Web Element, etc) acts inside that iframe until you switch back or the context is cleared.
Return to the main page with a second block. Add another Switch Frame set to Main page to exit all iframes and resume on the top-level page.
Nested iframes stack. For an iframe inside another iframe, add a Switch Frame block for each level in order; each one steps a level deeper. A single Main page clears every level at once.
Navigating or changing tabs resets it. Open Link, Go Back or Forward, and Switch or Close Tab clear the frame context on their own, as if you'd switched to Main frame right before. After any of them you're back on the main page and must switch in again.
There are two different timeouts to be aware of. This block's own Timeout controls how long it waits for the iframe element to appear. The blocks that act inside the iframe (Save Web Element, Hover Web Element, etc.) have their own Timeout for the elements within it; raise those separately if in-iframe elements are slow to load.
Block Behavior
When switching to an iframe that's found the block enters it and logs that it switched into the iframe. Every selector-based block that follows then resolves its target inside that iframe.
When the iframe selector can't be found the block fails with a selector error and stops the run. Wrap it in a Try-Catch block sequence if you'd rather handle a missing iframe than end the run.
When switching to Main page the block clears the frame context and logs that it returned to the main page. Subsequent blocks act on the top-level page again.
When you navigate or switch tabs the frame context resets automatically, as if you'd switched to Main page; a Click Web Element or Save Web Element block after an Open Link block then acts on the new page, not a stale iframe.
Last updated