Switch to Frame by Name
You can also switch to a frame by its name attribute.
On the Frames page, the nested frame has name="nestedFrame" and contains a parent with <h2>Parent frame</h2>.
Page DOM Structure:
<iframe name="nestedFrame" src="...">
<!-- Inside the parent frame: -->
<body>
<h2>Parent frame</h2>
<iframe src="...">
<!-- Child frame inside -->
<h3>Child frame</h3>
</iframe>
</body>
</iframe>
Task:
- Navigate to
https://testkru.com/Interactions/Frames
- Switch to frame with name
nestedFrame
- Find the h2 element and print its text
- Switch back to default content
Expected output:
Parent frame text: Parent frame