I have to select drop down option and its sub options.but getting error while selecting its sub category enter image description here

enter image description here


Judging by the error it looks like you are passing an li element instance to the Select() class constructor which expects select elements only.

Since both the li and select have the same id value, you need to additionally check for tag names - e.g. with a CSS selector:

WebElement selectElement = driver.findElement(By.cssSelector("select#cat_1219"));
Select selectInstance = Select(selectElement);

Not the answer you're looking for? Browse other questions tagged or ask your own question.