1

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

LuFFy
  • 8,799
  • 10
  • 41
  • 59
  • Possible duplicate of [How to avoid "StaleElementReferenceException" in Selenium?](https://stackoverflow.com/questions/12967541/how-to-avoid-staleelementreferenceexception-in-selenium) – Würgspaß Dec 08 '17 at 07:38

0 Answers0