Playwright + Python · Lesson 21 of 37
Module 21: Frames
Your task
Implement fill_frame_field(page, frame_selector, label, val):
Write it in the editor, then press Check answer (Ctrl + Enter).
payment_frame = page.frame_locator("#stripe-frame")
payment_frame.get_by_label("Card number").fill("4242 4242 4242 4242")
payment_frame.get_by_label("CVC").fill("892")Say goodbye to manual frame switching! In Playwright, frame_locator() seamlessly embeds frame navigation inside locator queries. In this lesson, you will master iframes and nested frames in Python. Let's master frames!
Part of the Playwright + Python course (Playwright with Python). Practice this concept live in the Playwright Online Compiler or explore our free automation practice form.
No! In Playwright, page and frame_locator instances are independent. You never have to switch back.
Ready? Solve the task in the editor
Use Check answer to mark it complete. Hints are there if you need them.
___