Skip to main content

Switch Frames

Switch actions allow you to change the test’s execution context.

Action icon Switch to Iframe

Action icon Switch to Main Window

TestCafe Studio automatically adds Switch actions to the test when you interact with an iframe during test recording.

Switch to Iframe

Corresponding TestCafe API method: t.switchToIframe().

The Switch to Iframe action switches the test’s browsing context to a specified iframe. TestCafe Studio performs the subsequent test actions in this iframe until it reaches the Switch to Main Window action in the test.

Parameter Description
Element Selector Identifies an iframe on the tested page.

Switch to Main Window

Corresponding TestCafe API method: t.switchToMainWindow()

The Switch to Main Window action switches the test’s browsing context from an iframe back to the main window.

Note

TestCafe Studio displays warnings when you reorder Switch Frames actions or move test actions between browsing contexts. After dragging, make sure the actions relate to their appropriate contexts. Otherwise, they can be executed incorrectly.

Action icon