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

1
  • Say Arrays.asList(columList) instead of just columnList. Commented May 25, 2020 at 6:39

1 Answer 1

1

You can replace it with the following code.

gridData.add(new ArrayList<>(Arrays.asList(columnList)));
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.