Bird
0
0

Consider a dropdown with options:

medium📝 query result Q4 of 15
Selenium Java - Handling Form Elements
Consider a dropdown with options:
1) Dog (value="d")
2) Cat (value="c")
3) Bird (value="b")
What option will be selected after executing select.selectByValue("c")?
ADog
BCat
CBird
DNo option selected
Step-by-Step Solution
Solution:
  1. Step 1: Identify the value attribute to select

    The method selectByValue("c") selects the option with value attribute "c".
  2. Step 2: Match value to option

    Option with value "c" is "Cat".
  3. Final Answer:

    Cat -> Option B
  4. Quick Check:

    Value "c" corresponds to Cat [OK]
Quick Trick: selectByValue matches option's value attribute [OK]
Common Mistakes:
  • Selecting by visible text instead of value
  • Confusing option text with value attribute
  • Assuming index-based selection

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Selenium Java Quizzes