0
// 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(String,String)未定義爲類型ExcelUtils
public static void setExcelFile(String Path,String SheetName) throws Exception {
FileInputStream ExcelFile = new FileInputStream(Path);
ExcelWBook = new XSSFWorkbook(ExcelFile);
ExcelWSheet = ExcelWBook.getSheet(SheetName);
}
但我得到一個錯誤,請幫我定義的方法setExcelFile,在此先感謝
你確定'setExcelFile'方法在'ExcelUtils'類中嗎? – ByeBye
是這樣的錯誤嗎?:https://stackoverflow.com/questions/26034994/selenium-with-java-and-testng-test-login-with-excel-datasheet –
你可以清除並重建你的項目來獲取擺脫問題。 – Murthi