0
 Workbook workbook = Workbook.getWorkbook(new File("C:\\Users\\Tsss-Pc1\\Desktop\\login.xls"));

        Sheet sheet = workbook.getSheet(0);
        String uname = sheet.getCell(0, 0).getContents();
        d.findElement(By.id("inputEmail")).sendKeys(uname);
        String pwd = sheet.getCell(1, 0).getContents();
        d.findElement(By.id("inputPassword")).sendKeys(pwd);
        d.findElement(By.xpath("//div[3]/div/button")).click();

这是我从 login.xls 读取用户名和密码的代码,我想将结果附加到同一文件的第三列中。

   WritableCell label = new Label(2,0, "pass");
        WritableSheet sheet1 = null;
        sheet1.addCell(label);

我尝试使用此代码,但它对我不起作用..谁能告诉我,如何做到这一点...

4

1 回答 1

0
WritableWorkbook workbook = Workbook.createWorkbook(new File("d://output6.xls"));
        WritableSheet sheet = workbook.createSheet("First Sheet", 0);

            Label label = new Label(0, 0, "pass"); 
             sheet.addCell(label);                  
                 workbook.write(); 
                    workbook.close();

                 }
于 2013-10-16T06:33:23.983 回答