I am unable to select an option from the drop-down menu. The right-click functionality is disabled on the drop-down, and whenever any button is clicked, the drop-down closes. To work around this, I manually selected the option and extracted the XPath using SelectorHub. However, I am encountering the following error:
Exception in thread 'main' org.openqa.selenium.support.ui.UnexpectedTagNameException: Element should have been 'select' but was 'div'"
Here is my code:
WebElement dropdownElement = driver.findElement(By.cssSelector(".selct-control.css-b62m3t-ontainer"));
dropdownElement.c`your text`lick();
Thread.sleep(3000);
WebElement objSelect = (WebElement) new Select(dropdownElement);
objSelect = driver.findElement(By.xpath("//div[contains(text(),'Final Returned (2)')"));
objSelect.click();
Thread.sleep(3000);