webdriver页面工厂中@FindAll和@FindBys注释之间的区别 [英] difference between @FindAll and @FindBys annotations in webdriver page factory

查看:333
本文介绍了webdriver页面工厂中@FindAll和@FindBys注释之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请解释webdriver页面工厂概念中@FindAll和@FindBys注释之间的区别。

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

推荐答案

当我们有多个标准来识别一个或多个WebElement对象时,我们可以在这些情况下使用这些注释。

We can use these annotations in those cases when we have more than a single criteria to to identify one or more WebElement objects.

@FindBys:当所需的WebElement对象需要匹配所有给定的条件时,请使用@FindBys注释

@FindBys : When the required WebElement objects need to match all of the given criteria use @FindBys annotation

@FindAll:当需要的WebElement对象需要匹配至少一个给定条件时,请使用@FindAll注释

@FindAll : When required WebElement objects need to match at least one of the given criteria use @FindAll annotation

用法:

@FindBys( {
   @FindBy(className = "class1")
   @FindBy(className = "class2")
} )
private List<WebElement> elementsWithBoth_class1ANDclass2;

此处List elementsWithBothclass1ANDclass2将包含满足两个条件的任何WebElement。

Here List elementsWithBothclass1ANDclass2 will contain any WebElement which satisfies both criteria.

@FindAll({
   @FindBy(className = "class1")
   @FindBy(className = "class2")
})
private List<WebElement> elementsWithEither_class1ORclass2  

此处List elementsWithEither_class1ORclass2将包含满足任何一个条件的所有WebElement。

Here List elementsWithEither_class1ORclass2 will contain all those WebElement that satisfies any one of the criteria.

这篇关于webdriver页面工厂中@FindAll和@FindBys注释之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆