List<WebElement> Columns = driver.findElements(By.xpath("//*[@id='result']/table/tbody/tr[..]/td"));
int columns = Columns.size();
List<WebElement> Rows = driver.findElements(By.xpath("//*[@id='result']/tbody/tr"));
int rows = Rows.size();
String[][] report = new String[columns][rows];
for(int i = 0; i < columns; i ++){
int current_col = 0;
for(int j = 0; j < rows; j ++){
report[current_col][j] = driver.findElement(By.xpath("//*[@id='..." + j + "']/td[" + i + "]")).getText();
}
report[current_col][rows] = driver.findElement(By.xpath("//*[@id='...']/td[" + i + "]")).getText();
}
//вывести на консоль записанное
System.out.println("-----------------------------------------------");
for(int i = 0; i < columns; i ++, System.out.println()){
System.out.print(report[i][0] + " |");
for(int j = 0; j < rows; j++){
System.out.print(report[i][j] + " |");
}
}
System.out.println("-----------------------------------------------");
Примерно так...
- Форум тестировщиков
- → Просмотр профиля: Репутация: panterka