lundi 20 novembre 2017

Selenium: How use FieldDecorator and Locator.ElementHandler with ArrayList?

I have some complex object on a Page and I would like become it from a simple WebElement from Selenium on one better abstraction:

public class MyPage {  

    @FindBy(css="select#testme")  
    public MograblogSelect select;  

    public void changeToOption2(){  
        select.val( "option2" );  
    }  

    public void changeToOption1(){  
        select.val( "option1 ");  

    }  
}

This works like a charm following the post: http://ift.tt/2mJ7uMF

But I don't know how to adapt the FieldDecorator and Locator.ElementHandler for be able they work with an ArrayList:

public class MyPage {  

    @FindBy(css="select#testmelist")  
    public List<MograblogSelect> selects;  

}

In this second case selects.get(0) always returns null. How should I do this?





Aucun commentaire:

Enregistrer un commentaire