In the Page class, I have the content like below:
static content {
child_criteria(wait: true) { $("li", class: "child").find("div",class:"childSelectIndex targetChildAgeFormContainer") }
}
And now using this content, I am trying to find the select tag and print the selected values. Code is here:
def child_age_boxes = child_criteria.find("li",class:"targetChildAgeForm",style:"")
def age_box_iterator = child_age_boxes.iterator()
println age_box_iterator.size()
//It prints :4
println age_box_iterator.hasNext()
//It prints false
if(age_box_iterator.hasNext())
{
age_box_iterator.next().find("select",class:"targetRoomSelect").value("2")
}
I saw this answer but want to know how to iterate using iterator? I found the iterator function of Navigator object HERE. It is like this:
Iterator<Navigator> iterator()
UPDATE: I don't know why even showing the size:4, the hasNext() is returning: false?
Aucun commentaire:
Enregistrer un commentaire