【问题标题】:Karate - locateAll filter and input field空手道 - locateAll 过滤器和输入字段
【发布时间】:2021-03-29 22:50:19
【问题描述】:

使用空手道,根据Karate - is it possible to find element according to part of its parameter,我尝试过使用:

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

但都没有用。

你知道语法有什么问题吗?

谢谢。

【问题讨论】:

    标签: automated-tests karate


    【解决方案1】:

    无论locate 返回的是一个Element 对象。所以你可以在上面调用方法。请阅读文档:https://github.com/intuit/karate/tree/master/karate-core#locate

    所以这应该有效:

    * list[0].input('12312312311111')
    * list[0].retry().input('12312312311111')
    

    【讨论】:

    • 非常感谢。它完美地工作。空手道是如此强大的测试框架。我越来越喜欢它了:)
    猜你喜欢
    • 1970-01-01
    • 2022-10-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-11-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多