[Solved] Is there a way to select an option from dropdown other than using ‘Select’ class in Selenium?

[ad_1]

Yes. The other way is, click on the dropdown menu and select the option from the dropdown using click method as below:

WebElement ele = driver.findElement(By.xpath("<Xpath of dropdown element>"));     // To find the dropdown web element
List<WebElement> options = driver.findElements(By.xpath("<Xpath of dropdown Options"));    // To find the dropdown options
ele.click();      // To click on the dropdown element
options.get(<index>).click();      //To click on the option..

[ad_2]

solved Is there a way to select an option from dropdown other than using ‘Select’ class in Selenium?