//queryPage = (HtmlPage) wb.getPage(wb.getCurrentWindow(), wrs);
//System.out.println(queryPage.getPageEncoding());
//Estado
HtmlForm form = queryPage.getFormByName("AG");
HtmlSelect select = form.getSelectByName("S7_");
List<HtmlOption> listEstadoOptions = select.getOptions();
for(int i=1; i< listEstadoOptions.size(); i++){
select.setSelectedAttribute(Integer.toString(i), true);
System.out.println("numEstado"+i);
System.out.println("estado"+listEstadoOptions.get(i).asText());
//Area (Somente as de engenharia: 20 a 23)
queryPage = (HtmlPage) wb.getPage(queryUrl);
form = queryPage.getFormByName("AG");
select = form.getSelectByName("S11_");
List<HtmlOption> listAreaOptions = select.getOptions();
for(int j=20; j< 24; j++){//So engenharia
select.setSelectedAttribute(Integer.toString(j), true);
System.out.println("numArea"+j);
System.out.println("area"+listAreaOptions.get(j).asText());
//IEF
queryPage = (HtmlPage) wb.getPage(queryUrl);
form = queryPage.getFormByName("AG");
select = form.getSelectByName("S9_");
List<HtmlOption> listIefOptions = select.getOptions();
for(int k=1; k< listIefOptions.size(); k++){
select.setSelectedAttribute(Integer.toString(k), true);
System.out.println("numIef"+k);
System.out.println("ief"+listIefOptions.get(k).asText());
//Programa
queryPage = (HtmlPage) wb.getPage(queryUrl);
form = queryPage.getFormByName("AG");
select = form.getSelectByName("S13_");
List<HtmlOption> listProgramaOptions = select.getOptions();
for(int m=1; m< listProgramaOptions.size(); m++){
System.out.println("m"+m);
select.setSelectedAttribute(Integer.toString(m), true);
System.out.println("numPrograma"+m);
System.out.println("programa"+listProgramaOptions.get(m).asText());
corrente = new Programa();
corrente.setNumEstado(i);
String estado = listEstadoOptions.get(i).asText();
corrente.setEstado(estado);
corrente.setNumAreaAvaliacao(j);
String areaAvaliacao = listAreaOptions.get(j).asText();
corrente.setAreaAvaliacao(areaAvaliacao);
corrente.setNumIef(k);
String ief = listIefOptions.get(k).asText();
corrente.setIef(ief);
String programa = listProgramaOptions.get(m).asText();
corrente.setNumPrograma(m);
corrente.setPrograma(programa);
listaDeProgramas.add(corrente);
System.out.println(i+estado+" "+j+areaAvaliacao+" "+k+ief+" "+m+programa);
programaDAO.insert(corrente);
//queryPage = (HtmlPage) wb.getPage(wb.getCurrentWindow(), wrs);
//form = queryPage.getFormByName("AG");
//select = form.getSelectByName("S13_");
//listProgramaOptions = select.getOptions();
}
//Ief
queryPage = (HtmlPage) wb.getPage(queryUrl);
form = queryPage.getFormByName("AG");
select = form.getSelectByName("S9_");
listIefOptions = select.getOptions();
}
//Area
queryPage = (HtmlPage) wb.getPage(queryUrl);
form = queryPage.getFormByName("AG");
select = form.getSelectByName("S11_");
listAreaOptions = select.getOptions();
}
//Estado
queryPage = (HtmlPage) wb.getPage(queryUrl);
form = queryPage.getFormByName("AG");
select = form.getSelectByName("S7_");
listEstadoOptions = select.getOptions();
}
}