samatabassum's Profile
Train
34
Points

Questions
3

Answers
6

  • Train Asked on November 5, 2014 in Selenium WebDriver.

    Thank you so much Lakshay. The issue has been resolved.

    • 2538 views
    • 4 answers
    • 0 votes
  • Train Asked on November 4, 2014 in Selenium WebDriver.

    The above error is fixed. I am getting a different error. As I am a beginner in Java programming and Selenium, I have difficulty in understanding the errors. Appreciate if you could help me out.

    Here is the following error message:

    Exception in thread “main” java.lang.NoClassDefFoundError: org/apache/xmlbeans/XmlObject

    at utility.ExcelUtils.setExcelFile(ExcelUtils.java:25)

    at automationFramework.Apache_POI_TC.main(Apache_POI_TC.java:18)

    Here is the code:

    Apache_POI_TC.java

    package automationFramework;
        import java.io.IOException;
        import java.util.concurrent.TimeUnit;
        import org.openqa.selenium.WebDriver;
        import org.openqa.selenium.firefox.FirefoxDriver;
        import pageObjects.*;
        import utility.ExcelUtils;
        import utility.Constant;
        import appModules.SignIn_Action;
            
        public class Apache_POI_TC {
        public static void main(String[] args) throws Exception {
            ExcelUtils.setExcelFile(Constant.Path_TestData + Constant.File_TestData,"Sheet1");
            WebDriver driver = new FirefoxDriver();
            driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
            driver.get(Constant.URL);
            SignIn_Action.Execute(driver);
            System.out.println("Login Successful, now its the time to Log Off Buddy");
            Home_Page.User_Account(driver).click();
            Home_Page.Sign_out(driver).click();
            driver.quit();
            ExcelUtils.setCelldata("Pass", 1, 3);
            }
        }
    

    ExcelUtils.java

    package utility;
            import java.io.FileInputStream;
            import java.io.FileNotFoundException;
            import java.io.FileOutputStream;
            import java.io.IOException;
            import org.apache.poi.xssf.usermodel.XSSFCell;
            import org.apache.poi.xssf.usermodel.XSSFRow;
            import org.apache.poi.xssf.usermodel.XSSFSheet;
            import org.apache.poi.xssf.usermodel.XSSFWorkbook;
        public class ExcelUtils {
            private static XSSFSheet ExcelWSheet;
            private static XSSFWorkbook ExcelWBook;
            private static XSSFCell Cell;
            private static XSSFRow Row;
        public static void setExcelFile(String Path, String SheetName) throws Exception{
            try{
                FileInputStream ExcelFile = new FileInputStream(Path);
                ExcelWBook = new XSSFWorkbook(ExcelFile);
                ExcelWSheet = ExcelWBook.getSheet(SheetName);
            } catch(Exception e){
                throw(e);
                }
            }
            
        public static String getCellData(int RowNum, int ColNum){
        try{
            Cell = ExcelWSheet.getRow(RowNum).getCell(ColNum);
            String CellData = Cell.getStringCellValue();
            return CellData;
        }catch(Exception e){
            return"";
            }
        }
        
        public static void setCelldata(String Result, int RowNum, int ColNum) throws Exception{
            try{
                Row = ExcelWSheet.getRow(RowNum);
                Cell = Row.getCell(ColNum, Row.RETURN_BLANK_AS_NULL);
                if(Cell == null){
                    Cell = Row.createCell(ColNum);
                    Cell.setCellValue(Result);
                }else{
                    Cell.setCellValue(Result);
                    }
                FileOutputStream fileOut = new FileOutputStream(Constant.Path_TestData + Constant.File_TestData);
                ExcelWBook.write(fileOut);
                fileOut.flush();
                fileOut.close();
            }catch(Exception e){
                throw(e);
                }
            }
        }
    
    • 2538 views
    • 4 answers
    • 0 votes
  • Train Asked on October 6, 2014 in Selenium WebDriver.

    Thanks a lot for the help. I was able to upgrade Selenium successfully. Now the code is running fine.

    • 2293 views
    • 2 answers
    • 0 votes
  • Train Asked on October 3, 2014 in Selenium WebDriver.

    Hi Jagadeesh,

    I haven’t done any coding yet. I just added an Excel file in Eclipse and when I open it from project explorer of Eclipse, its blank with no cells, no rows and columns.

    • 176688 views
    • 7 answers
    • 1 votes
  • Train Asked on August 21, 2014 in Selenium WebDriver.

    Thank you for the reply. I still have the same issue. It has not yet been resolved. I am wondering if I have downloaded the correct jar files or not. Can you please explain me the process of adding the jar files. I’ll tell you the procedure that I followed. I’ve downloaded the zip folder “poi-bin-3.10.1-20140818.zip ( 23MB, signed)” from the following link “http://poi.apache.org/download.html#POI-3.10.1”. I found 13 jar files. I’ve added all the jar files to the project library.
    Is this the right procedure of adding jars? And is that the correct zip folder that should be downloaded?

    • 176688 views
    • 7 answers
    • 1 votes
  • Train Asked on August 20, 2014 in Selenium WebDriver.

    Thanks a lot for your reply.
    I have downloaded the Apache POI jar files and then added them to the project library of Eclipse.  In Eclipse I created a package named “testData” . Then created a new file by right clicking on the package and saved it as TestData.xlsx. When I tried to open it, it was blank with no rows and columns in it. No cells were displayed and unable to edit the file. I tried to delete it and re-create it but had the same issue. Appreciate if you could help me out with this issue.

    • 176688 views
    • 7 answers
    • 1 votes