Bird
0
0

Which method in Selenium Java's Select class allows you to choose an option by matching the exact text displayed in the dropdown?

easy📝 Conceptual Q1 of 15
Selenium Java - Handling Form Elements
Which method in Selenium Java's Select class allows you to choose an option by matching the exact text displayed in the dropdown?
AselectByVisibleText(String text)
BselectByValue(String value)
CselectByIndex(int index)
DselectOptionByText(String text)
Step-by-Step Solution
Solution:
  1. Step 1: Identify method for visible text selection

    The Select class provides selectByVisibleText to select options by their displayed text.
  2. Step 2: Confirm other methods

    selectByValue selects by the option's value attribute, selectByIndex by position, and selectOptionByText does not exist.
  3. Final Answer:

    selectByVisibleText(String text) -> Option A
  4. Quick Check:

    Method name matches visible text selection [OK]
Quick Trick: Use selectByVisibleText for exact dropdown text [OK]
Common Mistakes:
  • Confusing selectByValue with visible text selection
  • Using non-existent methods like selectOptionByText
  • Selecting by index when text is needed

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Selenium Java Quizzes