Selenium IDE type="date" field won't type - selenium-ide

Im using Seleniums IDE to format a test for our web scanning environment.
On the first page, are two input fields, one for a start and one for an end date like so;
<input class="form-control" name="start_date" id="start-date" style="height:49px" value="2018-05-30" min="2018-05-30" max="2018-06-29" type="date">
For some reason, no command will type into this field, sendkeys, type, editcontent. None of them. Is there a certain way I have to format IDE to have it affect this field?

Taking a look a this, using Selenium 3.5.8 in Chrome today, I can:
type || id=start-date || YYYY-MM-DD

Related

Select an html input element by its current value with CSS or XPath?

Is it possible to select an html input element on its current value, using CSS or XPath selectors?
My input control is generated by a React App as
<input name="documents"
placeholder="Documents" required="" type="file" value="">
Or do the document.query… and document.evaluate() functions only query the initially loaded document?
In javascript I can get the current value of an input. But I am trying to write a selector for SeleniumIDE against a React app. My current efforts are
xpath=//input[contains(#value , 'document')]
or
css=input[value*='document']
but whereas I can easily select on name, I'm failing to select by value.
In the browser console I find that
document.querySelector("input[name=documents]").value
gives me a value "C:\fakepath\Upload a document.txt"
but
document.querySelector("input[value*=doc]")
gives me nothing

Date Select Error in Ektron

I have a form that is using the calendar/date selection tool within Ektron, but when users select the current date (or any date, for that matter), it gives an error saying that you need to select a date in the past.
We haven't tooled around in the code for this form, but it almost sounds like a validation issue.
Here's the code, as is, from Ektron.
<p align="center" style="text-align: left;">Date program was presented: 
<ektdesignns_calendar title="Date presented" id="Date_presented" onblur="design_validate_xpath('number(translate(.,\'-\',\'\')) <= number(translate($currentDate,\'-\',\'\'))',this,'Date in the past (required)');" ektdesignns_name="Date_presented" ektdesignns_caption="Date presented" ektdesignns_invalidmsg="Date in the past (required)" ektdesignns_validate="xpath:number(translate(.,'-','')) <= number(translate($currentDate,'-',''))" ektdesignns_basetype="calendar" ektdesignns_datatype="date" ektdesignns_validation="datePast-req" name="Date_presented">
<input type="text" size="30" readonly="readonly" unselectable="on" />
<img width="16" height="16" class="design_fieldbutton" alt="Select date" src="[skinpath]btncalendar.gif" unselectable="on" /></ektdesignns_calendar></p>
My knowledge on validation is limited, but it looks like it's parsing the date as an integer. Is it possible to add a day (+1) to the current date so that it interprets any day as valid as long as it's not in the future?
I guess this is a HTML form as opposed to a Smart form?
If so, have you checked the validation settings on the calendar field? If you edit the form, right-click on the field and choose Field Properties you will get the properties window. Go to the Validation tab and check the setting in the Validation drop down.
There are options for ensuring the date is in the past or the future. Perhaps one of these options has been set?

HTML5 multi="true" tag doesn't work

i use Eclipse kepler
in dynamic web project
i create html(HTML5) file and use code for Multi select file upload system
<input type="file" multiple="true" />
but can't select multiple with ctrl+click
and my eclipse has warning
Multiple annotations found at this line :
-Undefined attribute value(true)
-Undefined attribute value(true)
any suggestion?
You need to use the attribute's name as its value:
If the attribute is present, its value must either be the empty string
or a value that is an ASCII case-insensitive match for the attribute's
canonical name, with no leading or trailing whitespace.
(http://www.w3.org/TR/html5/infrastructure.html#boolean-attributes)
In other words, just use:
<input type="file" multiple>
or
<input type="file" multiple="multiple">
If it does not work, then the reason is that you are using a browser that does not support the multiple attribute, such as IE 9. To deal with such browsers, you can add some JavaScript that tests whether the input element has the multiple property and if it does not, creates some additional file input elements (possibly in a loop that lets the user specify any number of files).
The warning should really be an error message, since true is not a valid value for the multiple attribute. As #IlmoEuro explains, the value should be empty or multiple. However, the value has in practice no impact; browsers recognize just the attribute name and ignore the value (even if you write multiple="false" for example).

Validate range of dates with Regula

Is there any way to use #Range to validate a range of dates in Regula? (ditto #Min and #Max)
Or do I need to use #Custom?
#Range(min=
and
#Range(max=
do not seem to accept anything of the type Date - only numbers or strings.
Unfortunately #Range only accepts numbers. I think you can do something like this though:
<input type="hidden"
name="date"
id="date"
data-constraints="
#Future(date='2000/1/1', format='YMD')
#Past(date='2010/1/1', format='YMD')"
/>
This ensures that the date is after 2000/1/1 and before 2010/1/1 (i.e., in between). I didn't document the date parameter because I don't think I had implemented it when I wrote the documentation. Sorry; the documentation is a bit behind because I'm working on rolling version 1.3 of Regula out, that will have a lot more goodies. I'll be getting started on updating the documentation soon!
I found that the following hack works:
I added a second, hidden input that contains the date entered in the format of Date.getTime():
<input type="hidden" data-bind="value: myDateValue.getTime()" ... />
(I'm using Kendo MVVM, but I'm sure other MVVM libraries can handle the same approach)
Then for the constraint, on server side (ASP.NET MVC in my case) I'm generating the Unix time for the min and max:
#Range(min="<%= (dateTime1 - new DateTime(1970, 1, 1).ToLocalTime()).TotalSeconds %>",
max="<%= (dateTime2 - new DateTime(1970, 1, 1).ToLocalTime()).TotalSeconds %>")
EDIT
Need to use .TotalMilliseconds - and even so there's some unexplained discrepancy.

Chrome/HTML5: Input type number not respecting max attribute?

I have the following markup:
<input type="number" max="99" />
In Google Chrome (and possibly other webkit browsers), this will restrict the spinner's up arrow from going over 99, but it does not prevent the user from typing a number higher than 99. Even onblur, the invalid value is not removed/replaced or even a warning given that the value is invalid.
Am I misinterpreting how it's supposed to work, or is this a bug? I am using the latest version of Chrome (19 at the time of writing).
Edit:
To clarify, I want to know why a number greater than the specified max is allowed to be input in the first place. I realize that it gives a tooltip on form submission telling you that it's invalid, but it seems like inconsistent behavior that the spinner will not allow you to go above the max, yet you can simply type a number above the max at any time to circumvent it.
If this is desired behavior for some reason, why is that? And is there a better option to enforcing the input range without resorting to JS?
It does work but you only see an error message (tooltip) if you put a submit button and a form into your code:
<form action="#" method="get">
<input type="number" max="99" />
<input type="submit" value="Submit!" />
</form>
jsFiddle
​
It's an old question, but I didn't find any relevant answers for this question anywhere.
this behaviour is still around in chrome (version 61).
I have found a little trick that can be used in some situation.
it's relevant for those who use data-binding libraries like aurelia, angular etc.. I tested only on aurelia - but that should work also for others.
the trick relies on the fact that input of type range enforce the min/max constraints.
we simply create another input (of type range) that is bounded to the same value as the regular input, and we hide it via css.
when the user inputs something that is greater than the max value, it will snap back to the max value.
here's a demo in aurelia: https://gist.run/?id=86fc278d3837718be4691acd5625aaad