title: Selenium webdriver: How can I click these links?
body: <pre><code>&lt;a onclick="requestReportGeneration('857f23e1baa767622a91f970963d8918', 'reportDiv31','CSV')" href="javascript:void[0];"&gt;CSV&lt;/a&gt;
  &lt;a onclick="requestReportGeneration('64107e36323e5877c986edc98a17b6e8', 'reportDiv32','CSV')" href="javascript:void[0];"&gt;CSV&lt;/a&gt;
  &lt;a onclick="requestReportGeneration('2cad4d4e5c8855c47a88b6ddf8345735', 'reportDiv33','CSV')" href="javascript:void[0];"&gt;CSV&lt;/a&gt;
  </code></pre>
  
  <p>I have these three links on a page and I want to click each one in turn. I am reading all the links on the page into a list of WebElements and then I go through each one in turn if the href contains javascript:void[0] I then try to click it:</p>
  
  <pre><code>for (int i = 0; i &lt; allLinks.size(); i++) {
      String reportLink = allLinks.get(i).getAttribute("href");
  
      if (reportLink.contains("javascript:void[0];")) 
      {
          allLinks.get(i).click();
          /// Do some more stuff
      }
  </code></pre>
  
  <p>The problem is I keep getting an error saying the element is not visible. I have also tried just loading the page and instead of getting all the links doing</p>
  
  <pre><code>driver.findElement(By.xpath("//a[contains(@href,\"javascript:void[0]\")]")).click();
  </code></pre>
  
  <p>but that also just gives element not visible error.
  Can anybody tell me why this isn't working?</p>