Radim Bukovský
Radim Bukovský

Reputation: 357

Karate - locateAll filter and input field

Using Karate, according to Karate - is it possible to find element according to part of its parameter I have tried to do that using:

* def filter = function(x){ return x.attribute('placeholder').startsWith('Very') }
* def list = locateAll('input[placeholder]', filter)

But I have no idea how to use it for inserting the value. I have tried this:

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

and this:

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

but neither worked.

Have you any idea what is wrong in syntax?

Thank you.

Upvotes: 1

Views: 952

Answers (1)

Peter Thomas
Peter Thomas

Reputation: 58088

Whatever locate returns is an Element object. So you can call methods on it. Please read the documentation: https://github.com/intuit/karate/tree/master/karate-core#locate

So this should work:

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

Upvotes: 1

Related Questions