Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I fill a date input with Laravel Dusk?

I try to fill a date input with Laravel Dusk with this code:

$browser->type('cooked_at', (new Carbon())->format('Y-m-d'));
// ...

But I get this error:

Element must be user-editable in order to clear it

Every other input fields are OK. Just the one with type date fails.

How can I fill a date input with Laravel Dusk?

like image 767
rap-2-h Avatar asked Oct 12 '25 08:10

rap-2-h


1 Answers

According to this issue, you have to do something like:

$today = now();
$browser->keys('#cooked_at', $today->day)
        ->keys('#cooked_at', $today->month)
        ->keys('#cooked_at', $today->year);
// ...
like image 123
rap-2-h Avatar answered Oct 14 '25 02:10

rap-2-h