对于ExcelUtils类型,方法setExcelFile(String,String)未定义

时间:2017-09-06 07:38:51

标签: java selenium

// Declaring the path of the Excel file with the name of the Excel file
            String sPath = "E:\\Practice_space\\MyKDTTest\\src\\dataengine\\DataEngine.xlsx";

            // Here we are passing the Excel path and SheetName as arguments to connect with Excel file 
            ExcelUtils.setExcelFile(sPath, "TestSteps");

上面的代码我在java的主类中提到过。我正在调用方法setExcelFile,它已在另一个类中定义为下面的

public static void setExcelFile(String Path,String SheetName) throws Exception {
        FileInputStream ExcelFile = new FileInputStream(Path);
        ExcelWBook = new XSSFWorkbook(ExcelFile);
        ExcelWSheet = ExcelWBook.getSheet(SheetName);
       }

但是我收到了错误,请提前帮助我,

1 个答案:

答案 0 :(得分:1)

“简单”:编译器在编译上述代码时看到的类ExcelUtils 包含该方法定义。

换句话说:您的设置中的某些内容是错误的。例如,当您更改类的java源代码时,可能会发生这种情况 - 但是您忘记编译它。或者您忘了重新构建JAR存档。

长话短说:您的设置存在某种不一致之处。由于我们没有深入了解该设置,所以可以在这里说明一切!