FileInputStream input=new FileInputStream(new File("C:\\Report\\TestCase.xls"));
HSSFWorkbook workbook=new HSSFWorkbook(input);
HSSFSheet sheet=workbook.getSheet("KeywordFramework");
System.out.println("i am in");
How can i make my path a relative path ? Example (..\..\TestCase.xls) It should search the file in system and call it , is the requirement
HSSFWorkbook workbook=new HSSFWorkbook(input);
ExpectedOP=Cellvalue;
int LastRow = 1;
for(int i1=1;i1<5;i1++)
{
String sr [] =new String [10];
sr[i1]=driver.findElement(By.xpath(".//*[@id='stepList']/li["+i1+"]")).getText();
System.out.println("UserID = "+sr[i1]);
for (int j1=1;j1<sr.length;j1++)
{
if(ExpectedOP.equals(j1))
{
System.out.println("compare pass");
String status="PASS";
Row row1 = sheet.getRow(LastRow);
Cell cell2 = row1.createCell(18);
cell2.setCellValue(status);
System.out.println(status);
input.close();
FileOutputStream outFile =new FileOutputStream(new File("TestCase.xls"));
workbook.write(outFile);
}
else
{
System.err.println("compare fail");
String status = "FAIL";
Row row1 = sheet.getRow(LastRow);
Cell cell2 = row1.createCell(18);
cell2.setCellValue(status);
System.out.println(status);
input.close();
FileOutputStream outFile =new FileOutputStream(new File("TestCase.xls"));
workbook.write(outFile);
}
}
}
This is my code to compare value from website and excel and here am telling IDE to place the pass/fail result in cell number 18 , which i want to make dynamic and also in "i1<5" "5" should be removed and made dynamic which number of cell counts Thank you
Can you try like :
FileInputStream input=new FileInputStream(new File("TestCase.xls"));
In your code? I think it should work.
この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。
侵害の場合は、連絡してください[email protected]
コメントを追加