When i am trying to select an option from dropdown list i am getting the error \"Element should have been \"select\" but was \"a\" \" Below is my source code :
That's because this element is not <select>
but <a>
:)
When you find element with findElement(By.id("m1tlm0"));
click on it. I assume that then list of options will appear. Then select one with By.linkText
or By.xpath
and click()
on it.
The Select
class only works with <select>
tags that contain <option>
tags. If you have any other tag, it doesn't matter if it behaves like a <select>
would, it will be rejected.
The error is telling you this. You are giving it an <a>
tag.