Unable to select an option from dropdown list i tried with select by index, label and sending hot key....

I want to choose an option from a drop-down menu, but the problem is that when I do so, I can only see the list of available options and not the item index or index value. I tried random selection, but that didn’t work for me. i tried with the send hot key also… i tried to see the development code; once I clicked their option, it disappeared. i have attached all relevant images below, so if you could please assist, thank you in advance…



You can only use “selectOptionByLabel”, “selectOptionByValue” or “selectOptionByIndex” on a select tag. In your case, you have a div.

However, you can get the dropdown items into a list and then do your thing with the list.

Click on the arrow of the dropdown and have the list display and then right click on the list and choose “Inspect”. This should display the HTML of the list. There may be a class that is similar to each item in the dropdown.

def driver = DriverFactory.getWebDriver();
List<WebElement> list = driver.findElements(By.xpath('//div[@class="...

1 Like

Thank you for your reply… but problem here is once if get the list item if i try click on the list item getting disappeared so unable to inspect the element also and one more thing if i try to expand the class its hidden so unable to see class name also…i will try once your suggestion also…