Currently utilizing selenium, I am faced with the task of writing to an xpath element. Up until now, I have successfully executed a click on it using the following code snippet:
driver.findElement(
By.xpath("(.//*[normalize-space(text()) and normalize-space(.)='Vehicle:'])[1]/following::ul[1]"))
.click();
Following the click action, my next requirement is to write on the same element. For this purpose, I have been employing the code below:
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);
Although in the above example I attempted to input 'SED', unfortunately, I am encountering issues getting any text entered into the field.