how to set value in datePicker in ionic 2 automation testing appium - ionic-framework

I am working on ionic 2, for automation testing i have used appium and webdriver.io , i'm able to set value where input type is password or email, generally text input type.
<input id="i.email" type="email">
and setting value using
client.setValue('//*[#id="i.email"]', username)
but i want to set value into date picker but i'm unable to do so.. my code is as below..
<ion-datetime id="d.fromDt" pickerFormat="MMM DD YYYY"
[(ngModel)]="fromDate" doneText="ok" cancelText="clear"
displayFormat="DD - MM - YYYY"> </ion-datetime>
and i have tried setting value using
-- client.setValue('//*[#id="d.fromDt"]', 'May 22 2018')
-- client.element('//*[#id="d.fromDt"]').setValue('May 22 2018')
but nothing is working. also getting response from appium invalid element state: Element must be user-editable in order to clear it. can anyone help me to solve this?

Related

Safari 15 Desktop. How to set input field 'date' to empty default value

I'm currently working on a html form with input type="date" fields.
Unfortunately Safari 15 sets current date as a default value in every empty date field.
Is there a way to set the default to empty? Like in Chrome dd-mm-yyyy.
Thank you! :)

Ionic ion-datetime - Can't bind to 'first-day-of-week'

With the code below, I get a "Can't bind to 'first-day-of-week' since it isn't a known property of 'ion-datetime'."
But it is a known property in the documentation: https://ionicframework.com/docs/api/datetime#setting-the-first-day-of-the-week
Also if I'm not using a binding and setting it in the template, it is working:
first-day-of-week="1"
How come I get this issue? I'm using the latest version of ionic 6.
<ion-datetime
[locale]="locale"
[first-day-of-week]="firstDayOfWeek"
#datetimestart
[value]="startDateValue"
(ionChange)="startDateChanged(datetimestart.value)">
</ion-datetime>
do this
<ion-datetime
[locale]="locale"
first-day-of-week="0" <---- deafult start from Sunday
#datetimestart
[value]="startDateValue"
(ionChange)="startDateChanged(datetimestart.value)">
</ion-datetime>
and number "1" to start from Monday
first-day-of-week="1"
just change number for other days

Set initial value of DateInputElement

I need to set intial value for DateInputElement. The .dart file has a variable dob with initial value:
String dob='01/01/2013'
and html has
<input id='mydob' type='date' name='dob' required='true' bind-value='dob'/>
dob is not shown when UI is displayed. The control shows mm/dd/yyyy.
If I select a date on UI, the date value is populated in dob variable.
Although bind-value sets two way binding, still tried setting the value to dob as follows without success:
<input id='mydob' type='date' name='dob' required='true' value={{dob}} bind- value='dob'/>
Also tried the following in life cycle events but did not work:
DateInputElement e = query('#mydob');
e.value=dob;
The format you are trying to put into the field is wrong. It's supposed to be 2013-01-01 (YYYY-MM-DD) according to the RFC. This is completely independent from dart or any other binding.
I would add that it is nessary to have the 0. So it is 2013-01-01 and not 2013-1-1

iPad datetime input value format

I'm developing a webapp for iPad and i got stuck on something that should be pretty basic.
I have a form with a datetime input which can be edited but it's supposed to show a default value. I tried using the followin tag
<input type="datetime" id="xyz" name="xyz" value="1996-12-19T16:39:57" />
no default value shown, picker works fine, and if edited everything is fine, just not showing the default value I'm setting.
If I use this instead (which of course I can't use...) everything works perfectly and the default value is regularly shown
<input type="date" id="xyz" name="xyz" value="1996-12-19" />
I tried changing the date format in many ways, as suggested by various articles I found on the web, no luck...
After a day search I found the solution while looking for something else (!!!)
Future reference for whoever gets stuck on this like me, the correct format on iOS for DATETIME input type is
yyyy-MM-ddTHH:mm:ss.fffZ
and remember that it the date is GMT+0 (mine was off 2 hours)
hope it helps

Is it possible to specify the display format for a dijit.form.DateTextBox

Is it possible to specify the display format for a dijit.form.DateTextBox?
I know that dijit.form.DateTextBox gets its date format from the user's locale by default and I know I can swtich the locale to anything I want, but I need to just specify the date format and not change anything else. Is this possible?
Thanks.
Yes, you can do something like this:
var occursOnField = new dijit.form.DateTextBox({
constraints: { datePattern : 'yyyy-MM-dd' }
, promptMessage: "yyyy-MM-dd"
, invalidMessage: "Invalid date format. Use yyyy-MM-dd"
})
Update Jan 29, 2012:
Chrome and Dojo 1.6.1 compatibility bug.
If the day of month is being padded with too many 0s, use one less d in the date pattern to work around the bug. For example, on Google Chrome 16 and Dojo 1.6.1 : datePattern : 'yyyy-MM-dd' will give 2010-01-001 and datePattern : 'yyyy-MM-d' will give 2010-01-1.
try this simple thing:
<input type="text" name="Date" id="myDate" promptMessage="Please Enter Date" value="" data-dojo-type="dijit/form/DateTextBox" constraints="{datePattern:'dd-MMM-yyyy', strict:true}" />