0

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");

DATE

2

I would create a loop that selects the month field by index, then select any additional data points, increment the index and go back to the beginning of the loop.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.