【问题标题】:Cannot test input type datetime-local with Larave Dusk无法使用 Laravel Dusk 测试输入类型 datetime-local
【发布时间】:2020-01-16 16:47:46
【问题描述】:

我的表单中有以下代码。我需要让用户输入日期和时间。

<input type="datetime-local" class="form-control" id="collection_datetime" name="collection_datetime" required>

当尝试使用 Laravel Dusk 自动测试表单时,我总是会出错。

这是我试过的

 ->type('collection_datetime', Carbon::now()->format('Y-m-d\TH:i'))
->type('collection_datetime', '12/31/2019 12:59 PM')

没有一个有效。 您可以给我的任何建议都将不胜感激。 谢谢

【问题讨论】:

    标签: php laravel forms laravel-dusk


    【解决方案1】:

    这是有效的,我希望它对某人有所帮助。 在我看来这不是微不足道的,我希望有更漂亮的解决方案

                    ->type('collection_datetime', '13')
                    ->type('collection_datetime', 'sep')
                    ->keys('#collection_datetime', ['{tab}'])
                    ->type('collection_datetime', '2019')
                    ->keys('#collection_datetime', ['{tab}'])
                    ->type('collection_datetime', '0104AM')
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-12-10
      • 1970-01-01
      • 2018-11-07
      • 1970-01-01
      • 2018-08-06
      • 2017-04-12
      相关资源
      最近更新 更多