Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
981 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 Reply

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...