如何使用 WebdriverIO 清除输入 type="date" 中的日期

Jam*_*ama 5 webdriver-io

我现在正在使用WebdriverIO和开发一个网络应用程序。这些天我尝试根据输入设置日期type="date",但出现错误

无效元素状态:元素必须是用户可编辑的才能清除它。

并发现我可以通过使用来消除错误addValue(),但该值仍然不会被任何 API 清除。

client.clearElement('#deadline')
Run Code Online (Sandbox Code Playgroud)

还得到

无效元素状态:元素必须是用户可编辑的才能清除它。

如何从表单中删除该值?

L.E*_*.E. 0

这对我有用:

client.selectorExecute("#dateInput", function(inputs, value) {
    // you can run over the inputs
    for (var i = 0; i < inputs.length; i++) {
        if (inputs[i].type == 'date') // any condition
            inputs[i].value = "1973-12-09";
    }

    // or just do that:
    inputs[i].value = "1973-12-09";
    return;
})
Run Code Online (Sandbox Code Playgroud)