I have this select with months and years, I need to sear every month of 2016 one by one and click the "query" button wait load the data on the page and pick up some data, then move on to the next month and repeat the process continuously, Until the end of 2016.
I thought about doing this using a list
and an arraylist
, but I would have performance issues.
What you suggest in this case,An Iterator <WebElement>
?
How do I select the months and year 2016 one by one?
List<WebElement> meses = driver.findElements(By.id("sel_Mes"));
Iterator<WebElement> itr = meses.iterator();
while(itr.hasNext()) {
System.out.println(itr.next().getAttribute("value"));
}
or
List<String> mes = new ArrayList<String>();
mes.add("Janeiro");
mes.add("Fevereiro");
mes.add("Março");
mes.add("Abril");
mes.add("Maio");
mes.add("Junho");
mes.add("Julho");
mes.add("Agosto");
mes.add("Setembro");
mes.add("Outubro");
mes.add("Novembro");
mes.add("Dezembro");
List<String> ano = new ArrayList<String>();
ano.add("2016");