karatekarate-call-single

How to get row data from web table in Karate framework


The web table has a combination of textbox, span and checkboxes. I need to get first row of all the data in single def and have to verify with DB in order wise.

Ex: First row of table has columns like below.

OrderID(span), EmpName(input), IsHeEligible(checkbox), Address(span)

By using below,

def tebleFirstData = scriptAll("table/tbody/tr/td",'_.textContent') 

Able to get only span text data, not able to get input tag test data.

I tried below,

data = attribute("table/tbody/tr/td[5]/input",'value')

But, I'm able to get only single input tag attribute value.

How can I get all the data in single def, i.e span data and input data?


Solution

  • Below is the solution to get all row data from table..!

     * def UiFirstRowElements = locateAll("Row xpath")