0

I'm using Python 3.7 and Selenium, trying to imput a date and a time into two apparently identical text input boxes in a website, using send_keys().

The Time input box works fine, send_keys('00:00:00') writes the time as needed.

The Date input box does not react, no matter what formatting I try to send the string with. I've tried adding a .click(), .clear(), Keys.HOME, before writing, to no avail.

I dont know what the difference is.

startTimeBox = browser.find_element_by_name('TimeStart')
startTimeBox.get_attribute('outerHTML')
Out[187]: '<input name="TimeStart" id="TimeStart" title="Please enter start time" size="10" maxlength="12" value="00:00:00" type="time">'

startDateBox = browser.find_element_by_name('DateStart')
startDateBox.get_attribute('outerHTML')
Out[185]: '<input name="DateStart" id="DateStart" title="Please enter start date" size="10" maxlength="11" value="09/11/2018" style="" type="date">'

Well, looking at this side by side I noticed the "style" part that's present in the date box. I guess that might influence it.

mudo
  • 1
  • 2

1 Answers1

0

As JacobIRR mentioned in the comments, there could be a problem with Firefox Driver instead use Chrome driver or click the field before sending keys.

The solution to this is to try using click() before sending keys.

Samuel Liew
  • 76,741
  • 107
  • 159
  • 260