0

I'm working with an input box with type="time". Text can be typed into the field or it can be selected in 15 minute increments by clicking on the little clock symbol bringing up the drop down. What I need is two minutes past the current time but I getting an element not interactable error

The default in the input box is set to 12:00 AM. The ID is for sure time as it will highlight and delete the default time.

Here's what I've tried. The error is on the last sendKeys line

DateTimeFormatter dtf = DateTimeFormatter.ofPattern("h:mm a"); 
timeEntered = dtf.format(LocalDateTime.now().plusMinutes(2)).toString();

WebElement time = driver.findElement(By.id("time"));
time.click();
actions.sendKeys(Keys.ARROW_RIGHT).perform();
actions.keyDown(Keys.SHIFT).sendKeys(Keys.HOME).perform();
actions.sendKeys(Keys.DELETE).perform();
driver.findElement(By.id("time").sendKeys(timeEntered);

I also tried: driver.findElement(By.id("time")).clear();

org.openqa.selenium.ElementNotInteractableException: element not interactable

WeVie
  • 568
  • 2
  • 9
  • 25
  • 1
    Since you said it is working to highlight and delete the text from the input box, have you tried actions.sendKeys(timeEntered).perform(); – RKelley Feb 06 '20 at 22:04
  • Did you try using the actions class for clicking. Use mous hover first and then click. I think the method for that is `actions.moveToElement(time).perform` and then you can click in regular way or with the actions class. I hope this helps – pdrersin Feb 06 '20 at 22:05
  • Update the question with the relevant HTML – undetected Selenium Feb 07 '20 at 07:49
  • I tried `actions.sendKeys(timeEntered).perform();` and it's entered text but not the content of the variable. I've seen it input *:@! AM and and *:@% I realized this is the shift of the number keys so I had to add `actions.keyUp(Keys.SHIFT).perform();` to release the shift key. – WeVie Feb 07 '20 at 13:42

0 Answers0