我们可以在 UI Automation 的输入字段中提供空值或空字符串吗?

Can we give null values or empty strings in the input fields for UI Automation?

我是空手道自动化的新手,正在测试简单的登录 window 需要验证空白字段。当我在输入函数中插入空字符串“”时,该步骤失败了。我们如何才能做到这一点?

     * input("//input[@name='password']", " ")

我想验证当用户将密码字段留空时出现的错误消息。

提前致谢!

以下对我来说效果很好。所以也许你错过了一些东西。很大程度上取决于页面,也许有一些 JS 验证。

* driver 'https://github.com/login'
* input('#login_field', ' ')
* input('#password', ' ')
* submit().click("input[name=commit]")
* match html('#js-flash-container') contains 'Incorrect username or password.'

如果仍然卡住,请按照以下流程进行:https://github.com/intuit/karate/tree/develop/examples/ui-test