title: Extracting data from li tag under ul using Selenium Webdriver
body: <pre><code>&lt;ul class="dropdown-menu" aria-labelledby="dLabel"&gt;
     &lt;li&gt;&lt;a href="Resource/Guide/TCS Health Insurance - Hospitalisation Claim Reimbursement Guidelines.pdf" target="_blank"&gt;Hospitalization Guide&lt;/a&gt;&lt;/li&gt;
     &lt;li&gt;&lt;a href="Resource/Guide/TCS Helath Insurance - Domiciliary Claim Reimbursement Guidelines.pdf" target="_blank"&gt;Domiciliary Guide&lt;/a&gt;&lt;/li&gt;
  &lt;/ul&gt;
  </code></pre>
  
  <p>I am trying to get data under each li list but not able to extract value <strong>Domiciliary Guide</strong> from the above li list. </p>
  
  <p>In the below code, list of elements is displayed as elements but first list element, <code>ele.getText()</code> is not giving any output. </p>
  
  <p>Can anyone help me in extracting data from <code>Li</code>? </p>
  
  <pre><code>WebElement ul=testDriver.findElement(By.xpath("//*[@id='header']/div/div/ul[1]/li[5]/div/ul")); 
  List&lt;WebElement&gt; elements=ul.findElements(By.tagName("li"));
              System.out.println("elements::"+elements);
  
              for(WebElement ele:elements){
              System.out.println("text"+ele.getText());
  }
  </code></pre>
  
  <p>Thanks!</p>