# typehandling.GroovyCastException: Class cast error

**URL:** <https://forum.katalon.com/t/typehandling-groovycastexception-class-cast-error/8175>\
**Category:** Miscellaneous\
**Created:** [October 25, 2017, 8:05pm UTC](https://forum.katalon.com/t/typehandling-groovycastexception-class-cast-error/8175 "2017-10-25T20:05:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Praveen\_Kumar](https://avatars.discourse-cdn.com/v4/letter/p/ce73a5/32.png) [@Praveen\_Kumar](https://forum.katalon.com/u/Praveen_Kumar)\
**Post date:** [October 25, 2017, 8:05pm UTC](https://forum.katalon.com/t/typehandling-groovycastexception-class-cast-error/8175/1 "2017-10-25T20:05:04Z")

</div>

I am one object at " abc/td\_Amount Due" which gives 6 web elements represented by one object repository and i want text of all the 6 web elements. I am trying to use LIST here but class cast error is showing. I am sharing code, please have a look

public class webele  
{  
@Keyword  
public String value()  
{

```
 List <WebElement> elementList = (List<WebElement>) WebUI.getText(findTestObject('Page_ Review Allocations/td_Amount Due'))
 		
	// Fetching the size of the list
	
	int listSize = elementList.size()
	for (int i=0; i<listSize; i++)
	{
	  println elementList[i]
	}
}

```

}

error:Test Cases/abc- 111 FAILED because (of) org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object ‘1.50’ with class ‘java.lang.String’ to class ‘java.util.List’

here 1.50 is my text value of the webelement and there are 5 others text values which is also represented by same object. So all should be there in the list but not coming. Please provide any suggestion

---

<div class="post-metadata">

**Author:** ![Praveen\_Kumar](https://avatars.discourse-cdn.com/v4/letter/p/ce73a5/32.png) [@Praveen\_Kumar](https://forum.katalon.com/u/Praveen_Kumar)\
**Post date:** [October 26, 2017, 6:00pm UTC](https://forum.katalon.com/t/typehandling-groovycastexception-class-cast-error/8175/2 "2017-10-26T18:00:08Z")

</div>

solution to this issue: suggested by katalon studio people

public String value()  
{  
List listElement = WebUiCommonHelper.findWebElements(findTestObject(‘abc/td\_Amount Due’), 10)  
float totalValue = 0.00 //here i made mistake  
for(int i=0; i\< listElement.size(); i++)  
{  
String item = listElement[i].getText()

```
		totalValue = totalValue + Float.parseFloat(item) //here i also made mistake
		
	  
    }
	print totalValue
}
```
