I select a value from a drop list and need to read the label. I can't get it work. Any help is appreciated.
WebElement stSelection = driver.findElement(By.id("ddlGlobalStoreNumber"));
Select stSelect = new Select(stSelection); // Create a select object from select class for dropdown selection
stSelect.selectByIndex(16);
System.out.println(stSelect.getOptions().get(16).getText());
This line containing System.out
raise the error :
org.openqa.selenium.StaleElementReferenceException