Recall & Review
beginner
What is a prompt alert in web testing?
A prompt alert is a popup dialog that asks the user to enter some text input before continuing. It usually has a text box and OK/Cancel buttons.
Click to reveal answer
beginner
How do you switch to a prompt alert in Selenium with Python?
Use
driver.switch_to.alert to switch the WebDriver's focus to the alert popup so you can interact with it.Click to reveal answer
beginner
How do you send text input to a prompt alert in Selenium Python?
After switching to the alert, use
alert.send_keys('your text') to enter text into the prompt's input box.Click to reveal answer
beginner
How do you accept or dismiss a prompt alert in Selenium Python?
Use
alert.accept() to click OK and alert.dismiss() to click Cancel on the alert popup.Click to reveal answer
intermediate
Why is handling prompt alerts important in automated testing?
Because prompt alerts block interaction with the page until handled, tests must manage them to continue smoothly and verify user input scenarios.
Click to reveal answer
Which Selenium method switches focus to a prompt alert?
✗ Incorrect
Use
driver.switch_to.alert to access the alert popup.How do you enter text into a prompt alert in Selenium Python?
✗ Incorrect
The correct method is
send_keys() on the alert object.What happens if you do not handle a prompt alert in Selenium?
✗ Incorrect
Alerts block interaction until accepted or dismissed, so tests must handle them.
Which method clicks the OK button on a prompt alert?
✗ Incorrect
Use
accept() to confirm the alert.What is the correct order to handle a prompt alert with text input?
✗ Incorrect
You must first switch to the alert, then send text, then accept it.
Explain how to handle a prompt alert with text input in Selenium Python step-by-step.
Think about how you interact with popups blocking the page.
You got /3 concepts.
Why must automated tests handle prompt alerts carefully?
Consider what happens if a popup stays open during a test.
You got /3 concepts.