Playwright + Java · Lesson 22 of 38
Module 22: Frames
Your task
Implement fillIframeInput:
Write it in the editor, then press Check answer (Ctrl + Enter).
FrameLocator paymentFrame = page.frameLocator("iframe#stripe-payment");
paymentFrame.getByLabel("Card Number").fill("4242 4242 4242 4242");
paymentFrame.getByLabel("CVC").fill("123");In legacy tools like Selenium, automating iframes required constant manual switching back and forth. Playwright completely revolutionizes this with FrameLocator. In this lesson, you will learn how FrameLocator allows you to interact with elements inside iframes seamlessly. Let's master frames!
Part of the Playwright + Java course (Playwright with Java). Practice this concept live in the Playwright Online Compiler or explore our free automation practice form.
No! In Playwright Java, page and frameLocator instances are independent. You never have to switch back to the main document.
Ready? Solve the task in the editor
Use Check answer to mark it complete. Hints are there if you need them.
___