Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
889 views
in Technique[技术] by (71.8m points)

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

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.

Github Login Report

question from:https://stackoverflow.com/questions/65626158/can-we-give-null-values-or-empty-strings-in-the-input-fields-for-ui-automation

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...