difference between @FindAll and @FindBys annotations in webdriver page factory

前端 未结 4 1428
日久生厌
日久生厌 2020-12-09 04:05

Please explain the difference between @FindAll and @FindBys annotations in webdriver page factory concept.

4条回答
  •  被撕碎了的回忆
    2020-12-09 04:53

    @FindAll can contain multiple @FindBy and will return all the elements which matches any @FindBy in a single list.

    Example:

    @FindAll({
    @FindBy(id = "one"),
    @FindBy(id = "two")
    })
    public List allElementsInList;
    

    Whereas,

    @FindBys will return the elements depending upon how @FindBy specified inside it.

     @FindBys({
        @FindBy(id = "one"),
        @FindBy(className = "two")
        })
        public List allElementsInList;
    

    Where allElementsInList contains all the elements having className="two" inside id="one"

提交回复
热议问题