猿问

错误:无法为测试用例 5595c7f4-64d1-494e-b388-be47a3ca9947

您好,我的浏览器出现错误,我不知道如何解决。感谢未来的帮助


BIG阳
浏览 81回答 2
2回答

婷婷同学_

int row = 1;int previousRow=1; // I am assuming that first row index is 1while(true){    String previousDomain = "";    String previousDashboard ="";    if(row != 1){ // check its not the first row else it will throw an exception because row doesn't exist    previousRow = row - 1;    previousDomain = sheet.getRow(previousRow ).getCell(0).getStringCellValue();         previousDashboard = sheet.getRow(previousRow ).getCell(1).getStringCellValue();    }    String domain = sheet.getRow(row).getCell(0).getStringCellValue();   String dashboard = sheet.getRow(row).getCell(1).getStringCellValue();   // String report =      sheet.getRow(row).getCell(2).getStringCellValue();    if(!domain.equals(null))    {        listOfDashboards.add(domain + ";" + dashboard);        row++;       // System.out.println("" + domain + "" + dashboard +"" +     report);    }    else    {        break;    }}

叮当猫咪

假设“域”和“仪表板”是表头(th)。这是您可以使用的 xpath简单:硬编码的 td 索引(如果在仪表板单元之前添加了新单元,则会中断)"//td[normalize-space(.)='" + dashboard + "']/ancestor::tr/preceding-sibling::tr//td[2]//a"基于列名称的返回值:无论仪表板单元格的位置如何(首选)都有效"//td[normalize-space(.)='" + dashboard + "']/ancestor::tr/preceding-sibling::tr//td[position()=count(//th[normalize-space(.)='Dashboard']/preceding-sibling::th)+1]//a"
随时随地看视频慕课网APP

相关分类

Java
我要回答