I get this error->
java.lang.ClassCastException: java.lang.String cannot be cast to [Ljava.lang.String;
From the code pasted below.
public class LoginAttemps extends Setup {
public void testSearchCountry() throws Exception {
driver.get("http://www.wikipedia.org/wiki/Main_Page");
ReadExcelDemo readXls = new ReadExcelDemo();
List dataList = readXls.getData();
for (int i = 1; i < dataList.size(); i++) {
String[] testCase = new String[5];
String[] test = (String[]) dataList.get(i);
String countryName = test[0];
String countryDesc = test[1];
driver.findElement(By.id("searchInput")).clear();
driver.findElement(By.id("searchInput")).sendKeys(countryName);
driver.findElement(By.id("searchButton")).click();
String str = driver.findElement(
By.xpath("//h1[@id='firstHeading']/span")).getText();
System.out.println(countryDesc);
Assert.assertTrue(str.contains(countryName));
}
}
}
I think the issue is with String[] test = (String[]) dataList.get(i);
But I am not sure about resolving this exception.. Any clues?