Handle Popup Window
When a click opens a new tab/window, use page.waitForEvent('popup') to capture the new page.
On the Buttons page, clicking #openNewTab opens a new tab.
Task:
- Navigate to
https://testkru.com/Elements/Buttons - Set up
page.waitForEvent('popup')before clicking - Click
#openNewTab - Wait for the popup page, then print its URL
- Print the title of the original page
Expected output:
Popup URL: https://www.testkru.com/ Original title: Buttons
TestKru