Got the following exception with new Select(webelement) after upgrading to Selenium 4.11.0
java.lang.UnsupportedOperationException: getDomAttribute
at org.openqa.selenium.WebElement.getDomAttribute(WebElement.java:126)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.openqa.selenium.support.pagefactory.internal.LocatingElementHandler.invoke(LocatingElementHandler.java:51)
at com.sun.proxy.$Proxy21.getDomAttribute(Unknown Source)
at org.openqa.selenium.support.ui.Select.<init>(Select.java:51)
at com.icon.basePages.BaseFragment.selectOption(BaseFragment.java:278)
Error is throwing with the following method
protected void selectOption(String field, WebElement selectElement, String value) {
log.info(ReportUtils.formatAction("Select ", field, value));
Select select = new Select(selectElement);
select.selectByVisibleText(value);
}
with line Select select = new Select(selectElement);