Selenium Java - Handling Form Elements
Given the following code snippet, what will be the selected option's visible text after execution?
Assuming the dropdown options are:
0: Red
1: Green
2: Blue
3: Yellow
WebElement dropdown = driver.findElement(By.id("colors"));
Select select = new Select(dropdown);
select.selectByIndex(2);
String selected = select.getFirstSelectedOption().getText();Assuming the dropdown options are:
0: Red
1: Green
2: Blue
3: Yellow
