我不能寫在現有的Excel使用Selenium測試結果我都試過,但不斷有新的片覆蓋我的現有薄片無法寫入使用JExcelApi的
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();
}
嘗試使用getWorkbook代替createWorkbook。閱讀http://www.andykhan.com/jexcelapi/tutorial.html – Kavan