Selecting items in a combobox using Selenium Webdriver

  • Which Selenium Webdriver command is used for selecting items from combobox in Java? I mean when we want to select one item from a Combobox but this element is not an instance of Select class, e.g., element found by commands like this driver.findElement(

  • You need to create a Select element instead of a simple WebElement. Select selectObject = new Select(driver.findElement(; selectObject.selectByValue("Item1"); // Assuming you have an element with value Item1 in your combo box

Suggested Topics