Note that there are some explanatory texts on larger screens.

plurals
  1. POWrite Multiple data in different excel cells using selenium webdriver
    text
    copied!<p>In the following code i want to pass two data in two different cells. (Cell 1 and Cell 2).But its only showing data for cell 1.Someone please help.</p> <pre><code>import java.io.FileOutputStream; import java.util.concurrent.TimeUnit; import jxl.Workbook; import jxl.write.Label; import jxl.write.WritableSheet; import jxl.write.WritableWorkbook; import org.junit.After; import org.junit.Before; import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.Keys; import org.openqa.selenium.WebDriver; import org.openqa.selenium.firefox.FirefoxDriver; public class xl { private WebDriver driver; @Before public void setUp() throws Exception { driver = new FirefoxDriver(); driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); } @Test public void test() throws Exception { driver.get("http://www.google.com/"); String s = driver.getTitle(); writereport(0,0,s); writereport(1,1,"Valid"); } @After public void tearDown() throws Exception { driver.quit(); } public void writereport(int a,int b,String text) { try { FileOutputStream f = new FileOutputStream("C:\\DEMO.xls",true); WritableWorkbook book = Workbook.createWorkbook(f); WritableSheet sheet = book.createSheet("TESTRESULTS",0); Label i = new Label(a, b, text); sheet.addCell(i); book.write(); book.close(); } catch (Exception e) { e.printStackTrace(); } }} </code></pre> <p>I have tried Label i = new Label(a, b, text); sheet.addCell(i); Label P = new Label(a, b, text); sheet.addCell(p); But No luck</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload