Skip to content
CodeKruPro

frameLocator by Name

47/70

frameLocator by Name

You can target frames by any CSS selector, including [name="frameName"].

On the Frames page, the nested frame has name="nestedFrame" and contains <h2>Parent frame</h2>.

Task:

  1. Navigate to https://testkru.com/Interactions/Frames
  2. Access the frame with page.frameLocator() and an attribute selector that matches its name
  3. Get the h2 text inside and print it

Expected output:

Parent frame text: Parent frame