/** * Reads in a sky.sns.selenium IDE file and creates Sky Selenium format test code * * @param filename - Selenium IDE file to convert * @return Name of the Selenium IDE file * @throws Exception */ public String generateTestCode(String filename) throws Exception { FileHandler convertFrom = new FileHandler(convertToXML(filename)); XMLHandler seleniumXMLFile = new XMLHandler(convertFrom.getFile()); int commandCount = seleniumXMLFile.performXPathQueryReturnInteger("count(/html/body/table/tbody/tr)"); for (int i = 1; i <= commandCount; i++) { String command = ""; String target = ""; String value = ""; try { command = seleniumXMLFile.performXPathQueryReturnString("//table/tbody/tr[" + i + "]/td[1]"); target = seleniumXMLFile.performXPathQueryReturnString("/html/body/table/tbody/tr[" + i + "]/td[2]"); value = seleniumXMLFile.performXPathQueryReturnString("/html/body/table/tbody/tr[" + i + "]/td[3]"); } catch (Exception Ex) { LOGGER.warn("Invalid command '{}' found", command); } addToTestCode(codeGenerator.convertCommandToEbselenCode(command, target, value)); } convertFrom.close(); return convertFrom.getFileName().split("\\.")[0]; }