Bird
0
0

Which Selenium Java method is used to enter text into a prompt alert?

easy📝 Syntax Q12 of 15
Selenium Java - Handling Windows, Frames, and Alerts
Which Selenium Java method is used to enter text into a prompt alert?
Aalert.sendKeys("text")
Balert.enterText("text")
Calert.type("text")
Dalert.setText("text")
Step-by-Step Solution
Solution:
  1. Step 1: Recall Selenium Alert interface methods

    The Alert interface provides sendKeys() to input text into prompt alerts.
  2. Step 2: Verify method names

    Only sendKeys() is the correct method; others do not exist in Selenium Alert API.
  3. Final Answer:

    alert.sendKeys("text") -> Option A
  4. Quick Check:

    Use sendKeys() to input text [OK]
Quick Trick: Use sendKeys() to type text in prompt alerts [OK]
Common Mistakes:
  • Using non-existent methods like enterText()
  • Trying to use setText() which is not in Alert API
  • Confusing sendKeys() with WebElement methods

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Selenium Java Quizzes