I am using selenium and i need to write to and xpath element so far i managed to successfully make a click on it by using this
driver.findElement(
By.xpath("(.//*[normalize-space(text()) and normalize-space(.)='Vehicle:'])[1]/following::ul[1]"))
.click();
Then i need to write on it, i've been using this
WebElement ele = driver.findElement(By.xpath("(.//*[normalize space(text()) and normalize-space(.)='Vehicle:'])[1]/following::ul[1]"));
((JavascriptExecutor) driver).executeScript("arguments[0].value='SED'",ele);
In the example i tried to write SED but i can't it to enter any text
ul? Is there a text field with inul? Can you post the html of theulwith its children.<ul class="select2-choices"> <li class="select2-search-field"> <input type="text" autocomplete="off" autocorrect="off" autocapitilize="off" spellcheck="false" class="select2-input" id="s2id_autogen8" tabindex="2" style="width: 10px;"> </li></ul>@supputuriul.select2-choices input.select2-inputis the css that you can use. If you want to use the xpath then//ul[@class='select2-choices']//input[@class='select2-input'].