Recall & Review
beginner
What is a pop-up window in web testing?
A pop-up window is a small browser window that appears on top of the main window, often used for alerts, confirmations, or additional information.
Click to reveal answer
beginner
How do you switch control to a pop-up window in Selenium with Python?
Use
driver.switch_to.window(window_handle) where window_handle is the identifier of the pop-up window.Click to reveal answer
beginner
What method is used to accept an alert pop-up in Selenium Python?
Use
driver.switch_to.alert.accept() to click the OK button on an alert pop-up.Click to reveal answer
intermediate
Why is it important to switch back to the main window after handling a pop-up?
Because Selenium stays focused on the pop-up window, switching back ensures further commands affect the main page, avoiding errors.
Click to reveal answer
beginner
How can you get all open window handles in Selenium Python?
Use
driver.window_handles which returns a list of all window identifiers currently open.Click to reveal answer
Which Selenium method switches control to a pop-up alert?
✗ Incorrect
Use driver.switch_to.alert to access alert pop-ups specifically.
What does driver.window_handles return?
✗ Incorrect
driver.window_handles returns a list of all open window identifiers.
After closing a pop-up window, what should you do next?
✗ Incorrect
Switching back to the main window ensures further commands target the main page.
Which method accepts a confirmation pop-up in Selenium Python?
✗ Incorrect
accept() clicks OK on confirmation pop-ups.
How do you get the current window handle in Selenium Python?
✗ Incorrect
driver.current_window_handle returns the identifier of the current window.
Explain the steps to handle a pop-up alert window in Selenium Python.
Think about how Selenium changes focus to pop-ups.
You got /3 concepts.
Describe how to switch between multiple browser windows in Selenium Python.
Remember window handles are like window IDs.
You got /4 concepts.