空手道UI自动化-如何在无需输入字段的情况下按键(功能文件) [英] Karate-UI Automation - How to press key without necessity to be in input field (feature file)

查看:60
本文介绍了空手道UI自动化-如何在无需输入字段的情况下按键(功能文件)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在页面上时如何按键?例如:我需要按"ESC"键或某些组合键. 在文档中,描述了当您在输入字段中时如何执行此操作-可以正常工作.但是,如果我不想在不使用输入字段的情况下按下键按钮,我就不会成功(在功能文件中:例如,我已经尝试过此操作,但是它不起作用:driver.input(Key.ENTER)).

谢谢.

解决方案

这可能是我们实施中的空白,因此您可以提交问题,最好按照此过程进行操作,以便我们举个例子: https://stackoverflow.com/a/12187302/143475

在空手道中使用JS的一些技巧: https://stackoverflow.com/a/60800181/143475

How I press key when I am on the page?. E.g.: I need to press "ESC" key or some key combination. In documentation there is description how do this when you are in input field - it works fine. But if I want to press the key button without using input field I am not successful (In feature file: I have tried for example this, but it did not work: driver.input(Key.ENTER) ).

Thank you.

解决方案

This can be a gap in our implementation, so can you submit an issue, ideally following this process so that we have an example: https://github.com/intuit/karate/tree/develop/examples/ui-test

For the time being, see if you can work-around by firing a key-press event via JS. I am also hoping that if you target the body element it will work for the whole HTML page:

* input('body', Key.ENTER)

Reference for creating keyboard event: https://stackoverflow.com/a/12187302/143475

And some tips on JS in Karate: https://stackoverflow.com/a/60800181/143475

这篇关于空手道UI自动化-如何在无需输入字段的情况下按键(功能文件)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆