use of com.driver.locator.model.LocatorModel in project selenium_java by sergueik.
the class PageObjectGenerator method writeToFile.
@Override
public boolean writeToFile(String fileName, List<LocatorModel> dData) {
count = 1;
File file = new File(ResourceHelper.getResourcePath("pageobject/") + fileName + ".java");
if (!file.exists())
try {
file.createNewFile();
} catch (IOException e1) {
e1.printStackTrace();
}
try (FileWriter fWrite = new FileWriter(file, false)) {
fWrite.append("\n").append("public class " + fileName + " {");
for (LocatorModel model : dData) {
fWrite.append(getWebElementString(model.getLocatorType(), model.getLocatorValue()));
}
fWrite.append("\n").append("}");
} catch (Exception e) {
e.printStackTrace();
}
return false;
}
use of com.driver.locator.model.LocatorModel in project selenium_java by sergueik.
the class ExcelFileWriter method writeToFile.
@Override
public boolean writeToFile(String fileName, List<LocatorModel> dData) {
int i = 0;
try (XSSFWorkbook book = getWorkBook()) {
XSSFSheet sheet = book.createSheet(SHEET_NAME);
for (LocatorModel model : dData) {
XSSFRow row = sheet.createRow(i++);
row.createCell(0).setCellValue(model.getLocatorType());
row.createCell(1).setCellValue(model.getLocatorValue());
}
book.write(new FileOutputStream(new File(ResourceHelper.getResourcePath("excel/") + fileName + ".xlsx")));
return true;
} catch (Exception e) {
e.printStackTrace();
}
return false;
}
Aggregations