21. Seamless iframe Automation with frame_locator()

FrameLocator: Zero Context Switching

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")

Task

  • Implement fill_frame_field(page, frame_selector, label, val):
  • 1. page.frame_locator(frame_selector).get_by_label(label).fill(val)
πŸ’‘Common doubts
Did you like the problem?
Lesson 21 of 37
Python
Loading code editor…
Next