There is a drop-down on my screen which shows some selected value and it is disabled. I need the selected value from the drop-down list to put some assertions in Selenium.
How to get the selected value when drop-down is disbaled? enter image description here
I tried using below code:
Select billCycle = new Select(driver.findElement(By.xpath("//select[contains(@id,'BILL_CYC_CD')]")));
String billCycleValue = billCycle.getFirstSelectedOption().getText();
But I am getting below exception:
java.lang.AssertionError: org.openqa.selenium.StaleElementReferenceException: stale element reference: element is not attached to the page document
(Session info: chrome=110.0.5481.178)