问题
I am trying to automate form filling using robot framework. Could pass values to text fields, drop down list etc, stuck at date. Anyone who has done please help.
回答1:
You can send, e.g. a date 6 days from today, directly by setting the value of the datepicker element with javascript:
${my_date_to_select}= Get Current Date UTC 6 days %d/%m/%Y
Execute JavaScript document.getElementById('ID_OF_YOUR_DATEPICKER').value='${my_date_to_select}'
NB: In order to use the keyword 'Get Current Date', you need to add the library DateTime in your settings.
回答2:
Focus jquery=[name=expDate]
Press Key jquery=[name=expDate] 09255639
来源:https://stackoverflow.com/questions/27415347/how-do-i-send-value-to-a-date-picker-in-robot-framework