Bird
0
0

How can you combine explicit waits and keyboard actions to select an auto-complete option when suggestions appear on typing?

hard📝 Application Q9 of 15
Selenium Java - Handling Form Elements
How can you combine explicit waits and keyboard actions to select an auto-complete option when suggestions appear on typing?
ASendKeys(Keys.ENTER) immediately after typing
BWait for suggestions, then send Keys.ARROW_DOWN and Keys.ENTER to select
CUse Thread.sleep() then click first suggestion
DClear input field before typing
Step-by-Step Solution
Solution:
  1. Step 1: Wait for suggestions to appear

    Use explicit wait to ensure suggestions are visible before keyboard navigation.
  2. Step 2: Use keyboard keys to select

    Send ARROW_DOWN to highlight first suggestion, then ENTER to select it.
  3. Final Answer:

    Wait for suggestions, then send Keys.ARROW_DOWN and Keys.ENTER to select -> Option B
  4. Quick Check:

    Combine wait and keyboard keys for selection [OK]
Quick Trick: Use ARROW_DOWN + ENTER after waiting for suggestions [OK]
Common Mistakes:
  • Pressing ENTER too early
  • Using Thread.sleep() instead of explicit wait
  • Clearing input unnecessarily

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Selenium Java Quizzes