iFrame Support
TestFirst supports testing applications that use iFrames, including nested and embedded iFrame content.
Elements inside iFrames can be interacted with the same way as elements on the main page, whether tests are recorded using the Recorder or written manually using Gherkin.
Automatic iFrame Handling
TestFirst automatically detects and handles iFrame boundaries during recording and execution.
In most cases, users do not need to manually switch into frames. Tests transparently pass through iFrame boundaries, including cross-origin iFrames, allowing elements inside iFrames to behave as if they were part of the main page.
This allows you to:
Record interactions inside embedded frames reliably
Execute tests across nested iFrame structures
Work with pages containing multiple frames with similar elements
Replay Recorder-generated tests across iFrame boundaries automatically
Example
In this example, the button exists inside an iFrame, but no manual frame switching is required.
Scenario: Interact with elements inside an iFrame
Given browser "Chrome"
When I visit "https://playground.testfirst-qa.com/iframe"
And I click "'Click Me' button in 'Second Level Iframe' section"
Then "'Button Clicked' message" is displayedCurrent Automatic Handling Limits
Automatic iFrame traversal currently supports:
Up to 20 visible iFrames per page
Up to 3 nested iFrame levels
For more complex applications, manual iFrame handling can be used.
Improved / Manual iFrame Handling
Although iFrame handling is automatic in most cases, users can explicitly focus test execution on a specific iFrame when needed.
This can be useful for:
Very complex applications
Large pages with many iFrame elements
Improving selector precision
Working around automatic traversal limits
Deeply nested iFrame structures
Switch to a Frame
Use frame switching when you want to interact with elements inside a specific iFrame.
Example
Work with Nested Frames
TestFirst also supports nested iFrames (iFrames inside other iFrames).
Example
Remember Frames
You can remember frames by name and switch back to them later.
This is useful for complex applications with multiple frame contexts.
Example
Return to the Root Frame
Use the root frame command to exit iFrame context and return to the main page.
Example
Last updated

