2017-08-06 72 views
0

我有這樣的網絡元素:如何創建的網頁元素陣列(硒)

WebElement wikipedia1 = driver.findElement(By.tagName("h1")); 
    WebElement searchButton = driver.findElement(By.className("pure-button")); 
    WebElement EN = driver.findElement(By.className("js-enabled")); 
    WebElement searchfeild1 = driver.findElement(By.className("search-input")); 
    WebElement searchfeild2 = driver.findElement(By.id("search-input")); 
    WebElement letter = driver.findElement(By.className("sprite-icons-translate-icon")); 

我怎樣才能把它們放在網絡元素的數組?

+0

出了什麼問題'List'? – Guy

+0

List的聲明取決於您使用List執行的操作。你能否更新你的業務需求?謝謝 – DebanjanB

回答

0

這就是基本的Java的東西

WebElement[] elems = {wikipedia1, searchButton, letter}; 

WebElement[] elems = new WebElement[] {wikipedia1, searchButton, letter};