Content Between Frame and Main Page
Unlike Selenium, you never "switch" context in Playwright. You can access both the main page and frame elements in the same flow without any switching.
Task:
- Navigate to
https://testkru.com/Interactions/Frames - Get the main page heading (h2 on the main page)
- Get the frame1 heading (h1 inside the first
#frame1; the page has two frames with that id, so use'#frame1 >> nth=0') - Get the main page heading again (no switch back needed!)
Expected output:
Main page: Frames Frame content: CodeKru Back to main: Frames
TestKru