I am unable to write test results in existing excel using selenium I have tried but always new sheet override my existing sheet
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();
}
Instead of
try: