0

I have the below code.

List<WebElement> rowItems = driver.findElements(By.xpath("//div[@class='su-table su-table-alternate']//tr"));
List<WebElement> coloumnItems = driver
        .findElements(By.xpath("//div[@class='su-table su-table-alternate']//tr//td"));
String[] coloumnList = new String[coloumnItems.size() / rowItems.size()];
List<ArrayList<String>> gridData = new ArrayList<ArrayList<String>>();
int x = 0;
for (int i = 1; i < rowItems.size(); i++) {
    for (int j = 4; j < coloumnList.length; j++) {
        coloumnList[j] = coloumnItems.get(i).getText();
        // gridData.addAll(coloumnList[j]);
    }
    x++;
    gridData.Add(new ArrayList<String>(columnList));
}

I need to add my data in columnList to gridData.

gridData.Add(new ArrayList<String>(columnList)); throwing an error

NarendraR
  • 7,577
  • 10
  • 44
  • 82

1 Answers1

1

You can replace it with the following code.

gridData.add(new ArrayList<>(Arrays.asList(columnList)));
marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
LUJ
  • 107
  • 6