2014-10-02 33 views
0

我们有一个由“// input [contains(@ name,'smcNetwork')]”指定的元素列表。 我习惯了寻找像使用@FindBy查找WebElementS

@FindBy(xpath = "//*[id='myId']") private WebElement myelement; 

一个webelement但是,由于每个受试者中的XPath我提到返回一个数组(或列表我猜),我会做

List<WebElement> networks = driver.findElementsBy(xpath = "//input[contains(@name,'smcNetwork')]") 

我想这样做这在一个FindBy但它似乎没有工作:

@FindBy(xpath = "//input[contains(@name,'smcNetwork')]") private List<WebElement> networks; 

但那是返回null。你能以某种方式做到这一点吗?

回答

0

你可以这样做。

@FindAll({@FindBy(xpath = "yourpath")}) 
public List<WebElement> networks;