automated-tests - 空手道 - locateAll 过滤器和输入字段
问题描述
根据空手道的说法,使用空手道 - 是否可以根据部分参数找到元素我尝试使用以下方法:
* def filter = function(x){ return x.attribute('placeholder').startsWith('Very') }
* def list = locateAll('input[placeholder]', filter)
但我不知道如何使用它来插入值。我试过这个:
* retry().input(list[0], '12312312311111')
和这个:
* retry().input('list[0]', '12312312311111')
但都没有奏效。
你知道语法有什么问题吗?
谢谢你。
解决方案
任何locate
返回的都是一个Element
对象。所以你可以在上面调用方法。请阅读文档:https ://github.com/intuit/karate/tree/master/karate-core#locate
所以这应该工作:
* list[0].input('12312312311111')
* list[0].retry().input('12312312311111')
推荐阅读
- docker - Jenkins 在尝试连接到 unix:///var/run/docker.sock 上的 Docker 守护进程套接字时出现拒绝获得权限的错误
- python - AWS Sagemaker ValueError:使用字符串和日期时数组上不支持的 dtype 对象
- javascript - Javascript Math.ceil 和 Math.pow 返回错误答案
- javascript - 将远程计算机名称变量从批处理文件传递到 hta 并在弹出窗口或 html 窗口中打印出值
- javascript - 如何在二维数组幻灯片中的 pptxgenjs 上制作无边框表格
- vue.js - Jest Vuex:创建的钩子出错:“TypeError:无法读取未定义的属性'dispatch'”
- reactjs - useDispatch 无法识别来自打字稿文件的动作
- typescript - 配置 ts-node 加载 typescript 库文件
- r - R - 使用 ggplot + bbplot 个性化刻度轴刻度
- python - 如何使用字典根据用户输入替换另一个文件中的值?