Discussion
Use the following code to get the text of the selected option from a listbox: WebElement listElement = driver.findElement(elementId);
Select list = new Select(listElement);
WebElement selectedOption = list.getFirstSelectedOption();
String selectedText = selectedOption.getText();
0