Bird
0
0

You want to select the option "Manager" from a dropdown where options have values "emp", "mgr", "dir" and visible texts "Employee", "Manager", "Director". Which code correctly selects "Manager"?

hard📝 Application Q8 of 15
Selenium Java - Handling Form Elements
You want to select the option "Manager" from a dropdown where options have values "emp", "mgr", "dir" and visible texts "Employee", "Manager", "Director". Which code correctly selects "Manager"?
Aselect.selectByValue("mgr");
Bselect.selectByVisibleText("Manager");
Cselect.selectByIndex(1);
DAll of the above
Step-by-Step Solution
Solution:
  1. Step 1: Identify the value and visible text for "Manager"

    Value is "mgr", visible text is "Manager", and index is 1 (second option).
  2. Step 2: Check each method's correctness

    selectByValue("mgr") selects by value, selectByVisibleText("Manager") by text, selectByIndex(1) by position; all select "Manager".
  3. Final Answer:

    All of the above -> Option D
  4. Quick Check:

    Value, text, or index can select same option [OK]
Quick Trick: Value, text, or index can select same dropdown option [OK]
Common Mistakes:
  • Assuming only one method works
  • Confusing index with value
  • Using wrong visible text

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Selenium Java Quizzes