Bird
0
0

Which of the following best describes the data type returned by driver.getWindowHandles() in Selenium Java?

easy📝 Conceptual Q2 of 15
Selenium Java - Handling Windows, Frames, and Alerts
Which of the following best describes the data type returned by driver.getWindowHandles() in Selenium Java?
AList<String>
BSet<String>
CMap<String, String>
DArray<String>
Step-by-Step Solution
Solution:
  1. Step 1: Recall the return type of getWindowHandles()

    It returns a Set of Strings, where each String is a unique window handle.
  2. Step 2: Eliminate other options

    List and Array are ordered collections, but window handles are returned as a Set to avoid duplicates. Map is unrelated.
  3. Final Answer:

    Set -> Option B
  4. Quick Check:

    Return type of getWindowHandles() = Set [OK]
Quick Trick: getWindowHandles() returns a Set, not a List or Array [OK]
Common Mistakes:
  • Assuming it returns a List or Array
  • Confusing with Map data type
  • Not knowing it returns a collection of Strings

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Selenium Java Quizzes