I am getting error like ListVariable cannot be cast to java.util.List


I am calling the api which having the response in the form of List<List> and want to convert that response into the Table variable in Bot task.

I am getting error like java.lang.ClassCastException: org.webharvest.runtime.variables.ListVariable cannot be cast to java.util.List

<?xml version="1.0" encoding="UTF-8"?>

<config xmlns="http://web-harvest.sourceforge.net/schema/1.0/config"

    	<robot driver="universal" close-on-completion="true"

    			<capability name="SEARCH_ALL_WINDOWS" value="true" />

    			<http url="http://localhost:8080/data">
    				<var-def name="data_api">
    					<http url="http://localhost:8080/data/list" method="GET" >

    				import com.workfusion.studio.rpa.recorder.api.internal.representation.*

    				import com.workfusion.studio.rpa.recorder.api.*

    				import com.workfusion.studio.rpa.recorder.api.types.*

    				import com.workfusion.studio.rpa.recorder.api.custom.*

    				import static com.workfusion.studio.rpa.recorder.api.RandomValues.CharacterSet.*

    				def data = RTable.builder().build()

    				for (var in ${data_api}) {




    	<export include-original-data="true" />



@abhimanyu_thit try writing data_api in the loop without the dollar sign and brackets.

for (var in data_api) {

Let me know if it doesn’t work for you.


@ashapkina It is not working may be because,

If I print class println data_api.getClass(); then it shows
class org.webharvest.runtime.variables.ListVariable
If I print class println data_api.get(0).getClass(); then it shows
class org.webharvest.runtime.variables.NodeVariable.