Playwright · Junior · Pytanie 58 z 75
Jak kliknąć przycisk wewnątrz <iframe>?
- 1
page.getByRole('button', { frame: true }) - 2Lokatory automatycznie wchodzą do iframe
- 3
page.frameLocator('#pay').getByRole('button')
Pokaż odpowiedź
Poprawna odpowiedź: page.frameLocator('#pay').getByRole('button')
Wyjaśnienie
Iframe ma własny dokument. frameLocator (lub locator(...).contentFrame()) ogranicza do niego lokatory.