Skip to content

Date picker submission bug #1

@zayne-siew

Description

@zayne-siew

Issue Description

Date inputs that include the year are automatically converted into a date picker. The HTML element that controls the date picker requires a 'special' submission method using Selenium ActionChains (see src/questions/date.py).

On a local machine, Selenium ActionChains works fine. However, when deployed onto Heroku, the date value selected in the Telegram bot does not reflect onto the submitted form response.

Debugging/Troubleshooting Logs

  • day, month and year accurately store the selected day, month and year values from the date parsed. The value submitted using send_keys also gives the expected output:
"{:02d}{:02d}{:04d}".format(day, month, year)  # e.g. day=29, month=9, year=2021 ==> 29092021
  • On Heroku, the HTML date picker element is successfully being selected and values are being inputted correctly. Based on local machine testing, this means that both move_to_element_with_offset and send_keys are working (I think), since the form would not be able to submit successfully otherwise.
# On local machine testing, this method will input the key into the year value of the date picker
# and result in an invalid input. Subsequently, the form cannot be submitted.
# e.g. day=29, month=9, year=2021; browser: "dd/mm/2909", where "dd" and "mm" are placeholders in the form HTML.
self._ANSWER_ELEMENTS.click()
self._ANSWER_ELEMENTS.send_keys(key)

# The "special" method used via ActionChains gives the expected output on local machine testing.
# Something similar happens on Heroku deployment, but no idea why the value submitted is incorrect.
# e.g. day=29, month=9, year=2021; local browser: "29/09/2021", heroku: "09/02/2021".
action.move_to_element_with_offset(self._ANSWER_ELEMENTS, 0, 0) \
    .click() \
    .send_keys("{:02d}{:02d}{:04d}".format(day, month, year)) \
    .perform()

Replication Instructions

Use the Telegram bot to submit a response to any Google Form like this one with the abovementioned date picker HTML element, and check the recorded form response.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions