Complete the code to switch to the pop-up alert window.
alert = driver.switch_to.[1]()The switch_to.alert property switches the driver focus to the alert pop-up window.
Complete the code to accept (click OK) on the alert pop-up.
alert.[1]()The accept() method clicks the OK button on the alert pop-up.
Fix the error in switching back to the main window after handling a pop-up.
driver.switch_to.[1]()Use switch_to.default_content() to return focus to the main page after handling pop-ups or frames.
Fill both blanks to switch to a new browser window and then close it.
driver.switch_to.[1](driver.window_handles[1]) driver.[2]()
Use switch_to.window() to switch to the new window, then close() to close it.
Fill all three blanks to handle a prompt pop-up by sending text, accepting it, and switching back to main window.
alert = driver.switch_to.[1]() alert.[2]('Hello') alert.[3]()
First, switch to the alert with alert, then send text with send_keys(), and finally accept the prompt with accept().