Switch Between Frames

Navigate into and out of iframes.

Overview

Toffee supports testing web sites that use iframe elements to draw together content from multiple sources into one browser window. 

All locators are resolved from the content of the current frame.

Buttons, text boxes, and all other elements that are inside an enclosed iframe are invisible to Toffee, until you "zoom in" to that iframe with the switch to frame command.

Likewise, elements that exist outside the current frame are invisible to Toffee, until you "zoom out" to the enclosing frame with the switch to parent frame or switch to top frame commands.

The default frame for all web pages is the top-level window of the current web page.

These commands apply only to the current browser session. They require connection to a Toffee Performer, and they require a browser session be open on that Performer.

CommandExamplesExplanation
switch to frame <locator>
switch to frame with id "innerFrame"
“Zooms in” one level, into an iframe identified by the locator expression. Subsequent commands will be directed at the contents of that iframe.  If you need to zoom into an iframe within an iframe, you must issue two switch to frame <locator> commands.
switch to frame at xpath "//div[@id='container']/iframe"
switch to frame at selector "div.container > iframe"
switch to parent frame
switch to parent frame
“Zooms out” one level, so that all subsequent commands will be directed at the parent of the current frame. This may be an enclosing iframe, or the topmost window. If you are already on the topmost window, this command will fail.
switch to top frame
switch to top frame
“Zooms out” to the topmost level, so that all subsequent commands will be directed at the contents of the topmost window. If you are already on the topmost window, this command will succeed, but has no effect.