0

The target input element :

input ng-required="$ctrl.isRequired" name="" moment-picker="$ctrl.selectedFormattedDate" ng-model="$ctrl.selectedMoment" value="Fri Mar 27 2020 00:00:00 GMT+0530" ng-disabled="$ctrl.disabled" class="mw-date-picker mw-date-picker-dropdown ng-pristine ng-valid moment-picker-input md-input ng-not-empty ng-valid-required ng-valid-min-date ng-valid-max-date ng-touched" format="L" locale="en" min-view="year" max-view="month" start-view="month" timezone="$ctrl.timezone" today="$ctrl.isTodayHighlighted" change="$ctrl.handleDateChange(newValue, oldValue)" min-date="$ctrl.minDate" max-date="$ctrl.maxDate" tabindex="0" id="input_198" required="required" aria-invalid="false" style="">

I tried changing the attribute "value" using Python code: driver.execute_script("arguments[0].value = '03/10/2019';", element)

This commands updates the value in the front end but the changes are not saved after clicking OK(there is no issue with OK button click code). I also tried changing "moment-picker" but it did not help either. Can someone please help me with some way out using Python?

  • Is it possible to bind the value the the model that you are using? for instance using ng-value="$ctrl.selectedMoment" and you could even use the format pipe, though moment doesn't work with this iirc. you'd have to create your own pipe – Adam M. Apr 02 '20 at 13:10
  • 1
    You might have to trigger `onchange` /`keypress`/`associated` event as you are using javascript to update the value. When you used js it's updating the html but it's not triggering the event. Please refer to [this](https://stackoverflow.com/questions/55977388/textbox-events/55978587#55978587) to find the associated event. – supputuri Apr 02 '20 at 13:21
  • Actually, I am using python to execute JS functions using execute_script method, and it does not recognise the change function I am calling to trigger the event. So, can you please help me with the syntax for python? – Akshita Sood Apr 04 '20 at 15:51

0 Answers0