I am getting this error message when trying to select a drop-down value:
UnexpectedTagNameException with message 'Element should have been "select" but was "input" error'
The Error is descriptive in saying that the element is an "Input" element instead of a "Select" element, but the field is actually a multi select drop-down which the user can typeinto or select.
I am using the following command:
Select state = new Select(driver.findElement(By.id("stateCode")));
state.selectByIndex(6);
This is the HTML:
<div class="react-select__input" style="display: inline-block;">
<input autocapitalize="none" autocomplete="off" autocorrect="off" id="stateCode" spellcheck="false" tabindex="0" type="text" aria-autocomplete="list" value="" style="box-sizing: content-box; width: 2px; background: 0px center; border: 0px; font-size: inherit; opacity: 1; outline: 0px; padding: 0px; color: inherit;">
<div style="position: absolute; top: 0px; left: 0px; visibility: hidden; height: 0px; overflow: scroll; white-space: pre; font-size: 16px; font-family: "Open Sans", sans-serif; font-weight: 400; font-style: normal; letter-spacing: normal; text-transform: none;">
</div>
</div>
Is there another way to select the value from the drop-down?