Forum Discussion

Sabiha's avatar
Sabiha
Occasional Contributor
2 years ago
Solved

Unable to clear a (material ui 5) datepicker field on Firefox - works fine on Edge and Chrome

We have several date fields in our system, implemented using Material UI 5.10.2 datepicker. Our system is tested on Edge, Chrome and Firefox.

We have some tests that clear the text component part of the datepicker field using SetText("").

This is working fine on Edge and Chrome however on Firefox it does not clear the field. I have also tried using Keys("") followed by a Keys("[Tab]"], which does not work either 

Has anyone else come across this or anything similar to this?

Any ideas how I can clear the field in Firefox?

Thanks

  • Thanks Alex.

    obj.Keys("^A");  didn't work for me on Firefox, it opened a new tab with showing add-ons 

     

    however, this did work.

    obj.Click();

    obj.Keys(" "[Home]![End]") 

    obj.Keys("[Del]");

     

2 Replies

  • AlexKaras's avatar
    AlexKaras
    Champion Level 3

    Hi,

     

    Actually, .Keys("") does nothing, so I am not surprised that the field is not cleared. (To press Space key you should call .Keys(" ") -- space between quotes.)

    What if you give a try to something like:

    obj.Click(); // to set input focus into control;

    obj.Keys("^A"); // Control-A to select all text (or "[Home]![End" -- Home, then Shift-End for the same purpose, or anything else that will select all text within control

    obj.Keys("[Del]"); // Delete to clear the control

     

    Does it help?

     

  • Sabiha's avatar
    Sabiha
    Occasional Contributor

    Thanks Alex.

    obj.Keys("^A");  didn't work for me on Firefox, it opened a new tab with showing add-ons 

     

    however, this did work.

    obj.Click();

    obj.Keys(" "[Home]![End]") 

    obj.Keys("[Del]");