webdriver icon indicating copy to clipboard operation
webdriver copied to clipboard

Add new category for typeable form controls with normalization

Open Holo-xy opened this issue 5 months ago • 10 comments

There looks to be a popular demand for normalized date and datetime-local as seen in 1470 and 42322342. This introduces a new category to make the expected behavior explicit.


Preview | Diff

Holo-xy avatar Jul 06 '25 23:07 Holo-xy

P.S. I wasn't sure if I should group the common logic of non-typable and typeable or not.

Holo-xy avatar Jul 06 '25 23:07 Holo-xy

@sadym-chromium @whimboo @jgraham do you have a suggestion on how to best tackle input in the date fields? Should WebDriver require normalizing the input format?

OrKoN avatar Sep 11 '25 15:09 OrKoN

@sadym-chromium @whimboo @jgraham do you have a suggestion on how to best tackle input in the date fields? Should WebDriver require normalizing the input format?

Gentle Reminder.

Holo-xy avatar Nov 10 '25 11:11 Holo-xy

The approach LGTM, but the expected formats should be strictly defined.

sadym-chromium avatar Nov 11 '25 10:11 sadym-chromium

The approach LGTM, but the expected formats should be strictly defined.

I was thinking of doing something like this:

     <li><p>Normalize the <code>value</code> to conform to the expected input format of <var>element</var>.
      <ul>
        <li><p>For <code>type="date"</code> inputs, the <code>value</code> may be provided in <code>YYYY-MM-DD</code>, <code>YYYYMMDD</code>, or <code>MM-DD-YYYY</code> formats,
        and must be normalized to <code>MM-DD-YYYY</code>.
        <li><p>For <code>type="datetime-local"</code> inputs, the <code>value</code> may be provided in <code>YYYY-MM-DDTHH:MM:SS</code> or <code>MM-DD-YYYYTHH:MM:SS</code> formats,
        and must be normalized to <code>MM-DD-YYYYTHH:MM:SS</code>.
      </ul>
     <li><p><a>Set a property</a> <code>value</code> to <var>text</var>

I chose to normalize to MM-DD-YYYY and MM-DD-YYYYTHH:MM:SS since that seems to be what Chromium expects as input, which keeps changes minimal, but I'm not sure if this is the correct approach.

Holo-xy avatar Nov 13 '25 10:11 Holo-xy

I chose to normalize to MM-DD-YYYY and MM-DD-YYYYTHH:MM:SS since that seems to be what Chromium expects as input, which keeps changes minimal, but I'm not sure if this is the correct approach.

Does Chromium not support ISO 8601? I think that we should follow that format.

whimboo avatar Nov 13 '25 10:11 whimboo

I chose to normalize to MM-DD-YYYY and MM-DD-YYYYTHH:MM:SS since that seems to be what Chromium expects as input, which keeps changes minimal, but I'm not sure if this is the correct approach.

Does Chromium not support ISO 8601? I think that we should follow that format.

No, I tried inputting a date in ISO format, but the output was garbage (e.g. '2025-10-06' → '51006-02-02').

Holo-xy avatar Nov 13 '25 10:11 Holo-xy

@whimboo I believe the accepted format is dependent on the user locale.

OrKoN avatar Nov 13 '25 10:11 OrKoN

@Holo-xy I wonder if using locale overrides https://www.w3.org/TR/webdriver-bidi/#command-emulation-setLocaleOverride works around this issue? I imagine if you the locale is fixed, there could be no need for additional normalization?

OrKoN avatar Nov 13 '25 10:11 OrKoN

@whimboo I believe the accepted format is dependent on the user locale.

I don't think so, as I tested with different locales (US, UK, CH, which cover the three formats) and it didn't seem to make a difference.

Holo-xy avatar Nov 13 '25 11:11 Holo-xy