我有这个网络元素:

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"));


如何将它们放入Web元素数组中?

最佳答案

那是基本的Java东西

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


要么

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

关于java - 如何创建Web元素数组( Selenium ),我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/45530820/

10-12 12:38