title: How to check if form is visible (WebDriver)?
body: <p>I have two forms:</p>
  
  <pre><code>&lt;form action="" method="post" name="form1" id="form1" target="_self"&gt;
  ///
  &lt;/form&gt;
  
  &lt;style&gt;
  form#form2 {
      display: none;
  }
  &lt;/style&gt;
  &lt;form action="" method="get" name="form2" id="form2" target="_blank"&gt;
  ////
  &lt;/form&gt;
  </code></pre>
  
  <p>And I have the following code:</p>
  
  <pre><code>WebDriver driver = new HtmlUnitDriver();
  List&lt;WebElement&gt; forms = driver.findElements(By.cssSelector("form"));
  for (WebElement form : forms) { 
     if (!form.isDisplayed()) break;
     System.out.print(form.ToString() + "\n");
  }
  </code></pre>
  
  <p>In the console, I see:</p>
  
  <pre><code>&lt;form action="" method="post" name="form1" id="form1" target="_self"&gt;
  &lt;form action="" method="get" name="form2" id="form2" target="_blank"&gt;
  </code></pre>
  
  <p>How to check if form is invisible?</p>
  
  <p><strong>The solution of the problem.</strong></p>
  
  <pre><code>WebDriver driver = new HtmlUnitDriver(**true**);
  </code></pre>