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

Viewed 550

I am new to karate Automation, testing simple login window where need is to validate the blank fields. When I am inserting empty string " " in input function it's failing the step. How we can achieve this?

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

I want to validate the error message which appears when user leaves password field as blank.

Thanks in advance!

1 Answers

The below works fine for me. So maybe you are missing something. A lot depends on the page, maybe there is some JS validation.

* 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.'

If still stuck, please follow this process: https://github.com/intuit/karate/tree/develop/examples/ui-test

Related