无法使用JExcelApi

时间:2015-06-10 06:49:57

标签: java selenium-webdriver jexcelapi

我无法使用selenium在现有的excel中编写测试结果我尝试了但是总是新的工作表覆盖我现有的工作表

      String usernamevalidationmsg = a.findElement(By.id("UserNameRequired")).getText()

      String usernamevalidationexpected = "Email is required.";

      if (usernamevalidationmsg.equals(usernamevalidationexpected))
      {
        try
        { 
                   FileOutputStream f = new FileOutputStream("D:\\seleniumreport.xls",true);
                   WritableWorkbook book = Workbook.createWorkbook(f);
                   WritableSheet sheet = book.getSheet(0);
                   Label l = new Label(1, 2, "Pass");
                   sheet.addCell(l);
                   book.write(); 
                   book.close(); 
         }
         catch (Exception e)
         {
                   e.printStackTrace();
         }

1 个答案:

答案 0 :(得分:0)

而不是

$skipNewsListArr = array(1,2,3,4,5);

$wrongPaginationLinks = DB::table('news')
                        ->whereNotIn('news_id',$skipNewsListArr)
                        ->orderBy('news_date','desc')
                        ->paginate(5);

尝试:

   WritableWorkbook book = Workbook.createWorkbook(f);