Select class provides selectByVisibleText method to select dropdown options by text.
Step 2: Evaluate options
public void selectByText(String text) { new Select(dropdown).selectByVisibleText(text); } correctly creates Select object and calls selectByVisibleText. Others misuse dropdown or locator.
Final Answer:
public void selectByText(String text) { new Select(dropdown).selectByVisibleText(text); } -> Option B
Quick Check:
Select class + selectByVisibleText = public void selectByText(String text) { new Select(dropdown).selectByVisibleText(text); } [OK]
Quick Trick:Use Select class and selectByVisibleText for dropdowns [OK]
Common Mistakes:
Trying to sendKeys directly to dropdown
Using incorrect locators for options
Calling non-existent select method on dropdown
Master "Page Object Model" in Selenium Java
9 interactive learning modes - each teaches the same concept differently