Forum Discussion

vthomeschoolmom's avatar
vthomeschoolmom
Super Contributor
5 years ago
Solved

New to QuerySelector actions .. selecting an item from a <select> tag

Consider this monstrosity:   function DateFromPicker() { var month = "Apr"; var year = "2020"; var cssSelector = "#ui-datepicker-div > div > div > select.ui-datepicker-month"; var selM...
  • AlexKaras's avatar
    5 years ago

    Hi,

     

    Do you need to control date picker popup or just enter some date into the field and proceed?

    If the latter and value enter via .Keys() method call does not work, the following worked for me in (almost?) all cases:

    -- Assign required date using correct format to the field via either direct assignment to the .Value/wText/etc. property or via the .SetText() call. Investigate what will work in your case;

    -- Open date picker window. If you are lucky, it will be opened automatically after you either assign the value to the property or perform .SetFocus()/.Focus() call. If not, try to use either some key press (Down Arrow, for example) or click on the 'calendar' icon. The key point here is that date picker popup should be opened with correct date already selected;

    -- Confirm date selection by pressing Enter key. Quite often it works even if you do dateField.Keys('[Enter]') without the necessity of something like datePickerPopup.Keys('[Enter]').

     

    Does this help?