Skip to content Skip to sidebar Skip to footer

Need To Store Attribute Values Of A Table For Assertion In Karate

I have a case where locator doesn't have a text value but it's attribute named title has a text value that I need to assert. While writing custom locator for it I can only get the

Solution 1:

To get an attribute: https://github.com/intuit/karate/tree/master/karate-core#attribute

* deftemp= attribute('.table-cell', 'title')

And if you have an Element reference, you can call .attribute('title') on it: https://github.com/intuit/karate/tree/master/karate-core#chaining

But always keep in mind you can call the DOM JS API on any element, any time. So I leave it as a homework for you to figure out how to get the results of Element.attributes, ask a new question with specifically what you tried if needed.

Make sure you read about locateAll() with filter, for example: https://stackoverflow.com/a/63894989/143475

And also see this: https://stackoverflow.com/a/66900081/143475

Post a Comment for "Need To Store Attribute Values Of A Table For Assertion In Karate"