title: Using Selenium Webdriver how to retrive date text
body: <p>With selenium webdriver I need to get the text from a div tag which has a date in it how to go with that</p>
  
  <p>here is the HTML tag showing the div tag.</p>
  
  <pre><code>&lt;div class="gridlayout-column" style="padding-left: 10px; width: calc((100% - 110px) * 0.166667 + 10px);"&gt;
      &lt;div class="gridlayout-content"&gt;
          &lt;label class="fieldlabel"&gt;
              &lt;div class="fieldlabel-label"&gt;Last update&lt;/div&gt;
              &lt;div class="fieldlabel-content"&gt;Jul 12, 2017&lt;/div&gt;
          &lt;/label&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>I stored created a webelement for the above and tried using </p>
  
  <pre><code>WebElement lastUpdate = driver.findElement(By.xpath("//*[ . = 'Last update' and //div[contains(@class, 'fieldlabel-content')]]/following-sibling::div[@class='fieldlabel-content']"));
  
  lastUpadte.getText();
  </code></pre>
  
  <p>The output was --</p>
  
  <p>So I another option which is this </p>
  
  <pre><code>Date expiryDate = null;
      DateFormat formatter = new SimpleDateFormat("MMM DD, YYYY");
      String dateString = lastUpdate.getText();
       try {
         expiryDate = formatter.parse(dateString);
      } 
       catch (ParseException e) {
       e.printStackTrace();
      }
  </code></pre>
  
  <p>Still it didn't work. I am sure I am not doing it properly so please help me in fixing this issue.</p>