Do you want to write results/export run-time Data to excel sheets ?
Below is the sample script ...
import org.openqa.selenium.server.RemoteControlConfiguration;
import org.openqa.selenium.server.SeleniumServer;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
import com.thoughtworks.selenium.DefaultSelenium;
import com.thoughtworks.selenium.Selenium;
public class WriteExcel2 {
public Selenium selenium;
public static void main(String arg[]) throws IOException, BiffException, RowsExceededException, WriteException{
//Create File output stream object
FileOutputStream fo=new FileOutputStream("C:T2.xls");
WritableWorkbook wwb=Workbook.createWorkbook(fo);
WritableSheet ws=wwb.createSheet("Results", 0);
// define label and asign values
Label l = new Label(1, 1, "hi");
Label l1 = new Label(2, 1, "Result");
//pass values to respective cell
ws.addCell(l);
ws.addCell(l1);
// Close the objects
wwb.close();
fo.close();
}
Below is the sample script ...
import org.openqa.selenium.server.RemoteControlConfiguration;
import org.openqa.selenium.server.SeleniumServer;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
import com.thoughtworks.selenium.DefaultSelenium;
import com.thoughtworks.selenium.Selenium;
public class WriteExcel2 {
public Selenium selenium;
public static void main(String arg[]) throws IOException, BiffException, RowsExceededException, WriteException{
//Create File output stream object
FileOutputStream fo=new FileOutputStream("C:T2.xls");
WritableWorkbook wwb=Workbook.createWorkbook(fo);
WritableSheet ws=wwb.createSheet("Results", 0);
// define label and asign values
Label l = new Label(1, 1, "hi");
Label l1 = new Label(2, 1, "Result");
//pass values to respective cell
ws.addCell(l);
ws.addCell(l1);
// Close the objects
wwb.close();
fo.close();
}
No comments:
Post a Comment