Handle Nested Frames
Frames can be nested inside other frames. To reach a child frame, you must first switch to the parent frame, then to the child.
On the Frames page, the nested frame (name="nestedFrame") contains a child iframe with <h3>Child frame</h3>.
Nested Frame DOM Structure:
<!-- Main page -->
<iframe name="nestedFrame"> <!-- Step 1: switch here first -->
<h2>Parent frame</h2>
<iframe> <!-- Step 2: then switch here (index 0) -->
<h3>Child frame</h3>
</iframe>
</iframe>
You must switch to each frame level sequentially — you cannot skip directly to the child.
Task:
- Navigate to
https://testkru.com/Interactions/Frames
- Switch to the parent frame (
nestedFrame)
- Print the h2 text (parent frame content)
- Switch to the child frame inside it (index 0)
- Print the h3 text (child frame content)
Expected output:
Parent: Parent frame
Child: Child frame