My test code using Selenium / WebDriver stops running after reading Apache Poi data.
Can anyone tell me why?
//poi
WebElement searchbox = driver.findElement(By.name("simcard"));
try {
FileInputStream file = new FileInputStream(new File("C:\paulo.xls"));
HSSFWorkbook workbook = new HSSFWorkbook(file);
HSSFSheet sheet = workbook.getSheetAt(0);
for (int i=1; i <= sheet.getLastRowNum(); i++){
String simcard = sheet.getRow(i).getCell(0).getStringCellValue();
searchbox.sendKeys(simcard);
searchbox.submit();
driver.manage().timeouts().implicitlyWait(10000, TimeUnit.MILLISECONDS);
}
workbook.close();
file.close();
} catch (FileNotFoundException fnfe) {
fnfe.printStackTrace();
} catch (IOException ioe) {
ioe.printStackTrace();
}
The next step:
driver.findElement(By.xpath("/html/body/table/tbody/tr[4]/td/div/form/table/tbody/tr[2]/td/center/table/tbody/tr[19]/td/a[1]/img")).click();