title: Selenium: Add WebElements to a List, then check visibility of all of them
body: <p>Using Selenium and Cucumber, I'm trying to setup a method to store WebElements through args. Then with a second method, I'm trying to check the visibility of all elements on the list.</p>
  
  <p>I have some elements located this way:</p>
  
  <pre><code> @FindBy(how = How.XPATH, using = "//* 
   [@id=\"content\"]/section/fieldset/form/div[1]/div[2]/input")
   public WebElement formName;
   @FindBy(how = How.CSS, using = "//* 
   [@id=\"content\"]/section/fieldset/form/div[2]/div[2]/input")
   public WebElement formPassword;
   @FindBy(how = How.ID, using = "remember")
   public WebElement rememberMe;
   @FindBy(how = How.CLASS_NAME, using = "button principal")
   public WebElement loginButton;
  </code></pre>
  
  <p>Then I wrote this method to add WebElements in a list:</p>
  
  <pre><code>public void crearListaWebElement(WebElement... elements){
      List&lt;WebElement&gt; webElementList = new ArrayList&lt;&gt;();
      for (WebElement element : elements){
          webElementList.add(elements);
      }
  }
  </code></pre>
  
  <p>Getting this error on .add(elements) 1º issue:</p>
  
  <blockquote>
    <p>add
        (java.util.Collection)
        in List cannot be applied
        to
        (org.openqa.selenium.WebElement[])</p>
  </blockquote>
  
  <p>Cannot figure out why i can't add these same-type elements to my List</p>
  
  <p>Then, here is the second method to check visibility:</p>
  
  <pre><code>public void estaVisible(WebDriver(tried WebElement as well) visibleWebElements) {
  
      boolean esvisible =  driver.findElement(visibleWebElements).isDisplayed();
      Assert.assertTrue(esvisible);
      return esvisible;
  }
  </code></pre>
  
  <p>Getting this error on "visibleWebElement":</p>
  
  <blockquote>
    <p>findElement (org.openqa.selenium.By) in WebDriver cannot be applied to
    (org.openqa.selenium.WebDriver)</p>
  </blockquote>
  
  <p>I understand the conflict between the 2 different types of object, but, aren't the objects found by WebDriver stored as WebElements?</p>
  
  <p>Could someone put some light overhere please?
  Thanks in advance.
   </p>