1

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

closed as off-topic by c32hedge, IAmMilinPatel, Bharat Mane, NarendraC, alecxe Dec 21 '17 at 21:38

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers." – c32hedge, IAmMilinPatel, Bharat Mane, NarendraC, alecxe
If this question can be reworded to fit the rules in the help center, please edit the question.

1

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.