title: Selenium WebDriver getText()
body: <p>Using Selenium WebDriver .getText() function in Java, I'm trying to access some text without any positive results. Is not even in the WebElement object. The text I want to fetch is: &quot;eNewsletter Sign Up&quot;</p>
  <p>The HTML code from where I am fetching this looks like this:</p>
  <pre><code>&lt;a class=&quot;footer&quot; href=&quot;/contact/email-sign-up/&quot; onclick=&quot;aloneTracking('footerEmailSignUp')&quot;&gt;eNewsletter Sign Up&lt;/a&gt;
  </code></pre>
  <p>And the Java code looks like this:</p>
  <pre><code>     List&lt;WebElement&gt; idElemList = driver.findElements(By.className(&quot;footer&quot;));
  
      System.out.println(idElemList.size());
      String str = &quot;&quot;;
      if (idElemList.size() &gt; 0) {
          WebElement firstElement = idElemList.get(0);
          str = firstElement.toString();
          System.out.println(&quot;**** : &quot; + str);
          str = firstElement.getText();
          System.out.println(&quot;¨¨&quot; + str);
      }
  </code></pre>
  <p>In the first System.out.println() I get that the list is nine elements long.</p>
  <p>In the second:</p>
  <pre><code>&lt;a onclick=&quot;aloneTracking('footerEmailSignUp')&quot; href=&quot;/contact/email-sign-up/&quot; class=&quot;footer&quot;&gt;
  </code></pre>
  <p>In the third:</p>
  <pre><code>&lt;a onclick=&quot;aloneTracking('footerEmailSignUp')&quot; href=&quot;/contact/email-sign-up/&quot; class=&quot;footer&quot;&gt;
  </code></pre>
  <p>How can I get that text?</p>